## nth Rational number in Calkin-Wilf sequence

What is Calkin Wilf Sequence? A Calkin-Wilf tree (or sequence) is a special binary tree which is obtained by starting with the fraction 1/1 and… Read More »

Quick Links for Tree

Quizzes |

What is Calkin Wilf Sequence? A Calkin-Wilf tree (or sequence) is a special binary tree which is obtained by starting with the fraction 1/1 and… Read More »

Given a root node to a tree, find the sum of all the leaf nodes which are at maximum depth from root node. Example: 1… Read More »

Given a binary tree, flatten it into linked list in-place. Usage of auxiliary data structure is not allowed. After flattening, left of each node should… Read More »

Given a binary tree and the two nodes say ‘a’ and ‘b’, determine whether two given nodes are cousins of each other or not. Two… Read More »

Given two binary trees, the task is to check whether the two binary trees is a mirror of each other or not. Mirror of a… Read More »

Given a binary tree. The task is to check if the binary tree is sorted level-wise or not. A binary tree is level sorted if… Read More »

Given a binary tree and value k. delete all the leaf nodes with value equal to k. If a node becomes leaf after deletion, then… Read More »

Given a Binary tree and a number N, write a program to find the N-th node in the Postorder traversal of the given Binary tree.… Read More »

Given a binary tree, change the value in each node to sum of all the values in the nodes in the right subtree including its… Read More »

Given a Binary tree and a number N, write a program to find the N-th node in the Preorder traversal of the given Binary tree.… 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 tree, the task is to find the distance between two keys in a binary tree, no parent pointers are given. Distance between… Read More »

Given a Binary Tree having positive and negative nodes, the task is to find maximum product level in it. Examples: Input : 4 / \… Read More »

Given a binary tree and a node in the binary tree, find Postorder predecessor of the given node. Examples: Consider the following binary tree 20… Read More »