×
Home Discussions Write at Opengenus IQ
×
  • #7daysOfCode
  • C Interview questions
  • Linux 💽
  • 🔊 Data Structures
  • Graph Algorithms
  • Dynamic Programming 💑
  • Greedy Algo 📔
  • Algo Book 🧠
  • String Algo 🧬
  • Join our Internship 🎓
  • Home

binary tree

A collection of 12 posts

Algorithms

Diameter of a Binary Tree

In this problem, we are given input as the reference to the root of a binary tree. We need to find the diameter of the tree. We find the diameter using recursion and Depth First Search (DFS).

Amruta U. Koshe
Algorithms

Find number of Universal Value subtrees in a Binary Tree

In this article, we will be working on finding number of subtrees whose nodes have same value, called universal value subtree or simply univalue subtree.

Rashmitha
Algorithms

Find height or depth of a binary tree

Length of the longest path from the root node to a leaf node is the height of the binary tree. We find it in linear time using a recursive algorithm

Akshay Gopani Akshay Gopani
Algorithms

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
Algorithms

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
Algorithms

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
Data Structures

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
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 Foundation OpenGenus Foundation
×

Visit our discussion forum to ask any question and join our community

View Forum
OpenGenus IQ © 2021 All rights reserved â„¢ [email: team@opengenus.org]
Top Posts LinkedIn Twitter