Skip to content

Category Archives: Binary Search Tree

Given a BST and a key. The task is to find the inorder successor and predecessor of the given key. In case, if either of… Read More
Given an array representing preorder traversal of BST, print its postorder traversal.  Examples:  Input : 40 30 35 80 100 Output : 35 30 100… Read More
Given a binary search tree and a target node K. The task is to find the node with the minimum absolute difference with given target… Read More
Given a Binary Search Tree and a number N, the task is to find the smallest number in the binary search tree that is greater… Read More
Given a BST, the task is to find the sum of all elements greater than and equal to kth largest element. Examples:   Input : K… Read More
Given a Binary Search Tree which is also a Complete Binary Tree. The problem is to convert a given BST into a Special Max Heap… Read More
Self-Balancing Binary Search Trees are height-balanced binary search trees that automatically keeps height as small as possible when insertion and deletion operations are performed on… Read More
Pre-requisite : set in C++, unordered_set in C++ Differences : | set | unordered_set --------------------------------------------------------- Ordering | increasing order | no ordering | (by default)… Read More
In this post we will compare Red Black Tree and AVL Tree. Red Black Tree: Properties: Self-Balancing is provided by painting each node with one… Read More
Given two values n1 and n2 (where n1 < n2) and a root pointer to a Binary Search Tree. Print all the keys of tree… Read More
Given a Binary Search Tree(BST), convert it to a Binary Tree such that every key of the original BST is changed to key plus sum… Read More
Given a binary search tree and a key, your task to reverse path of the binary tree.Prerequisite : Reverse path of Binary tree Examples : … Read More
Euler tour tree (ETT) is a method for representing a rooted tree as a number sequence. When traversing the tree using Depth for search(DFS), insert… Read More
Given a binary search tree, task is to find Kth largest element in the binary search tree. Example: Input : k = 3 Root of… Read More
Given a Binary Search Trees, the task is to count the number of nodes which are having special two-digit numbers.Prerequisite : Special Two Digit Number… Read More