Skip to content

Category Archives: Binary Search Tree

For effective searching, insertion, and deletion of items, two types of search trees are used: the binary search tree (BST) and the ternary search tree… Read More
Given a binary tree and a target, find the number of nodes in the minimum sub-tree with the given sum equal to the target which… Read More
Given a Binary search tree(BST) and a positive integer K, find the maximum product of k integers in the tree. Return the product as an… Read More
Given a binary search tree and a target value, the task is to find the next smaller element of the target value in the binary… Read More
Given a binary search tree (BST) and a target value, find two nodes in the BST such that their product equals the given target value.… Read More
Given a binary search tree (BST), the task is to count the number of distinct elements present in it. Examples: Input:        5 … Read More
A self-balancing binary search tree (BST) is a type of binary search tree that automatically keeps its height balanced in order to guarantee that operations… Read More
Given a binary search tree and a target value, the task is to find the next greater element of the target value in the binary… Read More
Given a Binary Search Tree with unique node values and a target value. Find the node whose data is equal to the target and return… Read More
Given a Binary Search Tree, find the mode of the tree. Note: Mode is the value of the node which has the highest frequency in… Read More
Given an array arr[] of length N consisting of a positive integer, the task is to complete the Q queries and print values accordingly which… Read More
Splay tree is a self-adjusting binary search tree data structure, which means that the tree structure is adjusted dynamically based on the accessed or inserted… Read More
Binary Search Tree: A binary search tree is also called an ordered or sorted binary tree because the in-order traversal of binary search tree is… Read More
Given a Binary Search Tree, The task is to print the elements in inorder, preorder, and postorder traversal of the Binary Search Tree.  Input:  A… Read More
Given a binary tree and a target K, the task is to find the diameter of the minimum subtree having sum equal to K which… Read More