Given a Binary Tree (BT), convert it to a Doubly Linked List(DLL) In-Place. The left and right pointers in nodes are to be used as previous and next pointers respecti...

Share

Given an ancestor matrix mat[n][n] where Ancestor matrix is defined as below.
mat[i][j] = 1 if i is ancestor of j
mat[i][j] = 0, otherwise
Construct a Binary ...

Share

Given a Binary Tree where all values are from 0 to n-1. Construct an ancestor matrix mat[n][n]. Ancestor matrix is defined as below.
mat[i][j] = 1 if i is ancestor ...

Share

Given Linked List Representation of Complete Binary Tree, construct the Binary tree. A complete binary tree can be represented in an array in the following approach.
...

Share

Level order traversal of a tree is breadth first traversal for the tree.
Level order traversal of the above tree is 1 2 3 4 5
Recommended: Please solve it on ...

Share

Given an N-ary tree, find the number of siblings of given node x. Assume that x exists in the given n-ary tree.
Example :
Input : 30
Output : 3
Recommended : Ple...

Share

Write a function to print ZigZag order traversal of a binary tree. For the below binary tree the zigzag order traversal will be 1 3 2 7 6 5 4
Recommended: Please ...

Share

Given a Binary Tree, write a function to check whether the given Binary Tree is Complete Binary Tree or not.
A complete binary tree is a binary tree in which every le...

Share

Given a Binary Tree having positive and negative nodes, the task is to find maximum sum level in it.
Examples:
Input : 4
/
...

Share

There are two conventions to define height of Binary Tree
1) Number of nodes on longest path from root to the deepest node.
2) Number of edges on longest path from ro...

Share