A Set is a collection of distinct elements. Elements cannot be modified once added. There are various operations associated with sets such as union, intersection,… Read More

# Tag Archives: BST

AVL Trees are self-balancing Binary Search Trees where the difference between heights of left and right subtrees cannot be more than one for all nodes.… Read More

Given two positive integers N and K, the task is to find the number of binary search trees (BST) with N nodes of height greater… Read More

Given a Binary Search Tree consisting of N nodes and two positive integers L and R, the task is to find the sum of values… Read More

Given a Binary Tree, the task is to check if the given binary tree is a Binary Search Tree or not. If found to be… Read More

Given a string S of length N, and Q queries of the following type: Type 1: 1 i X Update the i-th character of the… Read More

Given a binary search tree and a node of the binary search tree, the task is to delete the node from the Binary Search tree… Read More

Double Threaded Binary Search Tree: is a binary search tree in which the nodes are not every left NULL pointer points to its inorder predecessor… Read More

Given a binary search tree containing N distinct nodes and a value K. The task is to count pairs in the given binary search tree… Read More

Construct the BST (Binary Search Tree) from its given level order traversal. Examples: Input : {7, 4, 12, 3, 6, 8, 1, 5, 10} Output… Read More

Given a binary search tree. The task is to print all even nodes of the binary search tree.Examples: Input : 5 / \ 3 7… Read More

Given N elements to be inserted into Binary Search Tree. The task is to construct a binary search tree with only insert operation and finally… Read More

Given N, Find the total number of unique BSTs that can be made using values from 1 to N. Examples: Input: n = 3 Output:… Read More

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