×
Home Discussions Write at Opengenus IQ
×
  • DSA Cheatsheet
  • HOME
  • Track your progress
  • Deep Learning (FREE)
  • Join our Internship πŸŽ“
  • RANDOM
  • One Liner

Problems on Binary Tree

Binary Tree is one of the most common data structures that are used in solutions of various Interview and Competitive Programming problems. Practice problems on Binary Tree.

Problems on Binary Tree

Find k-th smallest element in Binary Search Tree

Given root of the tree and k as input, output K th smallest element. We reduce the time complexity from O(N) to O(log N).

Parth Maniyar Parth Maniyar
Problems on Binary Tree

Algorithm to convert Binary Search Tree into Balanced Binary Search Tree

In this article, we will explore an algorithm to convert a Binary Search Tree (BST) into a Balanced Binary Search Tree in linear time O(N).

Parth Maniyar Parth Maniyar
Problems on Binary Tree

Copy a binary tree where each node has a random pointer

We explored an algorithm to copy a binary tree with an additional pointer which points to any random node in the tree. We explored two techniques Naive solution using 2 traversals and Efficient solution using hashing.

Akshay Gopani Akshay Gopani
Problems on Binary Tree

Learn how to traverse a Binary Tree (Inorder , Preorder , Postorder)

In this article we will learn three Depth first traversals namely inorder, preorder and postorder and their use. These three types of traversals generally used in different types of binary tree. In summary, Inorder: left, root, right; Preorder: root, left, right and Postorder: left, right, root

Akshay Gopani Akshay Gopani
Problems on Binary Tree

Algorithm for finding minimum or maximum element in Binary Search Tree【O(log V) / O(V)】

Binary Search Tree is a node-based binary tree data structure and finding the maximum or minimum element take O(log N) in average and can take O(N) in the worst case to O(1) in the best case.

Parth Maniyar Parth Maniyar
Problems on Binary Tree

Understand everything about Binary Search Tree

Binary search tree is a data structure that quickly allows us to maintain a sorted list of numbers in a tree data structure. It can be used to search for the presence of a number in O(log(n)) time and a simple traversal gives the numbers in sorted order.

Vaibhav Gupta
Problems on Binary Tree

Algorithm for finding the minimum number of swaps required to convert a binary tree to binary search tree

We developed an algorithm for finding the minimum number of swaps required to convert a binary tree to binary search tree. The Idea is do the inorder traversal of binary tree and store it in an array.Then find the minimum number of swaps require to sort an array which is the output we want.

Parth Maniyar Parth Maniyar
Problems on Binary Tree

Binary Tree

A binary tree is a tree data structure in which each node has upto two children (that is a maximum of two children nodes), which are referred to as the left child and the right child. Implementation and applications of binary tree

Nisarg Shah Nisarg Shah
Sorting Algorithms

Heap Sort

Heapsort is an efficient in-place comparison based sorting algorithm with O(N log N) time complexity and uses a data structure to achieve it. It uses a complete Binary Heap data structure to sort the elements depending on whether the heap is Min Heap (ascending) or Max heap (descending).

P Arun Kumar P Arun Kumar
Data Structures

Treap / Randomized cartesian tree

A treap is a height balanced binary tree with heap properties. It is used to store a sequence in a tree, which allows for various applications like searching. It takes O(log N) time complexity for search, insert and delete operations and takes O(N) space complexity

Yash Aggarwal Yash Aggarwal
Data Structures

Cartesian Tree

A Cartesian tree is a binary rooted tree data structure that can answer range queries can be answered by finding least common ancestors in the tree. An inorder traversal of the tree would give the original sequence used to form the tree. It is used as binary search tree for an ordered sequence

Yash Aggarwal Yash Aggarwal
Data Structures

How many labeled and unlabeled binary tree can be there with N nodes?

In this article, we see how many labeled and unlabeled binary trees we can have with N nodes. This is related to the Catalan Numbers. Binary Tree : A tree whose elements have 0 or 1 or 2 children is called a binary tree.

Akash Agrawal Akash Agrawal
Problems on Binary Tree

Properties of a Binary Tree

properties of Binary Tree are as follows: The maximum number of nodes at level β€˜L’ of a binary tree is 2L-1, Maximum number of nodes in a binary tree of height β€˜H’ is 2H – 1, In a Binary Tree with N nodes, minimum possible height or minimum number of levels is ⌈ Log2(N+1) βŒ‰

OpenGenus Tech Review Team OpenGenus Tech Review Team
OpenGenus IQ © 2025 All rights reserved β„’
Contact - Email: team@opengenus.org
Primary Address: JR Shinjuku Miraina Tower, Tokyo, Shinjuku 160-0022, JP
Office #2: Commercial Complex D4, Delhi, Delhi 110017, IN
Top Posts LinkedIn Twitter
Android App
Apply for Internship