Given a Binary Search Tree (BST)consisting of N nodes and two nodes A and B, the task is to find the median of all the… Read More

# Tag Archives: tree-traversal

Given an N-ary tree consisting of N nodes, the task is to find the node having the largest value in the given N-ary Tree. Examples:… Read More

Given a Binary Tree consisting of N nodes having distinct values from the range [1, N], the task is to find the lowest common ancestor… Read More

Given a Binary Tree consisting of N nodes and two integers K and L, the task is to add one row of nodes of value… Read More

The tree is a hierarchical Data Structure. A binary tree is a tree that has at most two children. The node which is on the… Read More

Given a Binary Tree, the task is to modify the Tree by left rotating every node any number of times such that every level consists… Read More

Given a binary tree, the task is to print the inorder traversal of the modified tree obtained after shifting all the nodes of the given… Read More

Given a Binary Tree consisting of N nodes, the task is to find the sum of Bitwise AND of the sum of all leaf nodes… Read More

Given a Binary Tree, the task is to find the smallest subtree that contains all the deepest nodes of the given Binary Tree and return… Read More

Given a Binary Tree, the task is to remove the leaf nodes of the Binary Tree during each operation and print the count. Examples: Input: … Read More

Given an N-ary tree rooted at 1, the task is to assign values from the range [0, N – 1] to each node in any… Read More

Given a Binary Search Tree, the task is to print the nodes of the BST in the following order: If the BST contains levels numbered… Read More

Given a Tree with N nodes values from 1 to N and N – 1 edges. The task is to find the maximum matching in… Read More

Given a Binary Tree and an integer D, the task is to check if the distance between all pairs of the same node values in… Read More

Given a Generic tree, the task is to delete the leaf nodes from the tree. Examples: Input: 5 / / \ \ 1 2 3… Read More