Find the number of leaf nodes in a perfect N-ary tree of height K. Note: As the answer can be very large, return the answer… Read More
Category Archives: Tree
We know a tree is a non-linear data structure. It has no limitation on the number of children. A binary tree has a limitation as… Read More
Given a binary tree, a target node and a positive integer K on it, the task is to find the sum of all nodes within… Read More
Given an N-ary Tree. The task is to print the level order traversal of the tree where each level will be in a new line.… Read More
A binary tree is a type of data structure where each node can only have two offspring at most named as “left” and “right” child.… Read More
Given a binary tree, the task is to print all the nodes of the binary tree in Pre-order, Post-order, and In-order in one iteration. Examples:… Read More
Given a full binary tree where each node value is the same as the minimum value between its children, the task is to find the… Read More
Given a directed binary tree of N nodes whose edges are directed from the parent to the child, the task is to count the number… Read More
Given a tree of N vertices, the task is to find the number of pairs of vertices such that the distance between them is even… Read More
Given, a binary tree, the task is to convert this tree using minimum number of increment-decrement operations into a tree which satisfies the following conditions:… Read More
Given an n-ary Tree having N nodes numbered from 1 to N, the task is to print a list of nodes containing 0, 1, 2,… Read More
Given a binary tree, the task is to: Print all the leaf nodes and then delete them all. Repeat this process till the tree becomes… Read More
Given a Binary Tree where each node has a value of either 0 or 1, the task is to convert the given Binary tree to… Read More
A binary tree is a tree data structure in which each node has at most two child nodes, referred to as the left and right… Read More
Given an array arr[ ] which contains N positive integers and an integer K and a vector of queries Q . Two types of queries… Read More