## 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 »

## Flatten BST to sorted list | Decreasing order

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

## Count of nodes which are at a distance X from root and leaves

Given two integers N and X, where N is the number of nodes in an almost complete binary tree. The task is to find: The… Read More »

## Total number of possible Binary Search Trees using Catalan Number

Given an integer N, the task is to count the number of possible Binary Search Trees with N keys. Examples: Input: N = 2 Output:… Read More »

## Find the node with maximum value in a Binary Search Tree using recursion

Given a Binary Search Tree, the task is to find the node with maximum value. Examples: Input: Output: 22 Recommended: Please try your approach on… Read More »

## Generic Trees(N-array Trees)

The Generic trees are the n-ary trees which have the following properties: Many children at every node. The number of nodes for each node is… Read More »

## Find the node with minimum value in a Binary Search Tree using recursion

Given a Binary Search Tree, the task is to find the node with minimum value. Examples: Input: Output: 4 Recommended: Please try your approach on… Read More »

## Longest subsequence with first and last element greater than all other elements

Given a permutation from 1 to N of size N. Find the length of the longest subsequence having the property that the first and last… Read More »

## Construct the Rooted tree by using start and finish time of its DFS traversal

Given start and finish times of DFS traversal of N vertices that are available in a Rooted tree, the task is to construct the tree… Read More »

## Convert a given Binary Tree to Circular Doubly Linked List | Set 2

Given a Binary Tree, convert it to a Circular Doubly Linked List. The left and right pointers in nodes are to be used as previous… Read More »

## Density of Binary Tree using Level Order Traversal

Given a Binary Tree, find the density of it by doing one traversal of it. The density of binary tree is defined as: Density of… Read More »