Find maximum among all right nodes in Binary Tree

Given a Binary Tree. The task is to find the maximum value among all of the right child nodes of the Binary Tree. Note: If… Read More »

Introduction to Merkle Tree

Merkle tree also known as hash tree is a data structure used for data verification and synchronization. It is a tree data structure where each… Read More »

Shannon-Fano Algorithm for Data Compression

DATA COMPRESSION AND ITS TYPES Data Compression, also known as source coding, is the process of encoding or converting data in such a way that… Read More »

Coefficient of Range in a Binary Tree

Given a Binary Tree, the task is to find the Coefficient of Range in it. Range is defined as the difference between the maximum and… Read More »

Level Order Successor of a node in Binary Tree

Given a binary tree and a node in the binary tree, find Levelorder successor of the given node. That is, the node that appears after… Read More »

Level Order Predecessor of a node in Binary Tree

Given a binary tree and a node in the binary tree, find Levelorder Predecessor of the given node. That is, the node that appears before… Read More »

Print all the levels with odd and even number of nodes in it | Set-2

Given an N-ary tree, print all the levels with odd and even number of nodes in it. Examples: For example consider the following tree 1… Read More »

Distance between two nodes of binary tree with node values from 1 to N

Given a binary tree with as its root and for any parent its left child will be 2*i and right child will be 2*i+1. The… Read More »

Print the nodes of binary tree as they become the leaf node

Given a binary tree. First print all leaf nodes, after that remove all the leaf nodes from the tree and now print all the new… Read More »

Sum of all odd nodes in the path connecting two given nodes

Given a binary tree and two nodes of that binary tree. Find the sum of all nodes with odd values in the path connecting the… Read More »

Print levels with odd number of nodes and even number of nodes

Given an N-ary tree, print all the levels with odd and even number of nodes in it. Examples: For example consider the following tree 1… Read More »

Number of leaf nodes in the subtree of every node of an n-ary tree

Given an N-ary tree, print the number of leaf nodes in the subtree of every node. Examples: Input: 1 / \ 2 3 / |… Read More »

Print path between any two nodes in a Binary Tree

Given a Binary Tree of distinct nodes and a pair of nodes. The task is to find and print the path between the two given… Read More »

Check if two nodes are in same subtree of the root node

Given a Binary Tree with distinct nodes. Given two nodes node1 and node2, check if the two nodes lies in the same subtree of the… Read More »

XOR of path between any two nodes in a Binary Tree

Given a binary tree with distinct nodes and a pair of two nodes. The task is to find the XOR of all of the nodes… Read More »