## Find the color of given node in an infinite binary tree

Given an infinitely long binary tree having a pattern as below: 1 / \ 2 3 / \ / \ 4 5 6 7 /… Read More »

## Check if the given n-ary tree is a binary tree

Given an n-ary tree, the task is to check whether the given tree is binary or not. Examples: Input: A / \ B C /… Read More »

## Find Leftmost and Rightmost node of BST from its given preorder traversal

Given a preorder sequence of the binary search tree of N nodes. The task is to find its leftmost and rightmost node. Examples: Input :… Read More »

## Implementing Backward Iterator in BST

Given a Binary search tree, the task is to implement backward iterator on it with the following functions. curr(): returns the pointer to current element.… Read More »

## Number of pairs with a given sum in a Binary Search Tree

Given a Binary Search Tree, and a number X. The task is to find the number of distinct pairs of distinct nodes in BST with… Read More »

## Find the minimum absolute difference in two different BST’s

Given 2 Binary Search Trees, select one node from each tree such that their absolute difference is minimum possible. Assume each BST has at-least one… Read More »

## Construct BST from its given level order traversal | Set-2

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 »

## Nodes from given two BSTs with sum equal to X

Given two Binary search trees and an integer X, the task is to find a pair of nodes, one belonging to the first BST and… Read More »

## Pair with minimum absolute difference | BST

Given a binary search tree of size N > 1, the task is to find the minimum absolute difference between any two nodes. Examples: Input:… Read More »

## Triplet with a given sum in BST | Set 2

Given a binary search tree, and an integer X, the task is to find if there exists a triplet with sum X. Print Yes or… Read More »

## Flatten binary tree in order of post-order traversal

Given a binary tree, the task is to flatten it in order of its post-order traversal. In the flattened binary tree, the left node of… Read More »

## Number of ways to divide a Binary tree into two halves

Given a binary tree, the task is to count the number of ways to remove a single edge from the tree such that the tree… Read More »

## Cartesian tree from inorder traversal | Segment Tree

Given an in-order traversal of a cartesian tree, the task is to build the entire tree from it. Examples: Input: arr[] = {1, 5, 3}… Read More »

## Pair with a given sum in BST | Set 2

Given a binary search tree, and an integer X, the task is to check if there exists a pair of distinct nodes in BST with… Read More »

## Flatten BST to sorted list | Increasing order

Given a binary search tree, the task is to flatten it to a sorted list. Precisely, the value of each node must be lesser than… Read More »