Given a non-empty binary tree, print the average value of the nodes on each level.
Examples:
Input :
4
/
2 9
/
3 5 7
Output : [4 5.5 5]
The ave...

Share

Given two binary trees, we have to check if each of their levels are anagrams of each other or not.
Example:
Tree 1:
Level 0 : 1
Level 1 : 3, 2
Level 2 : 5, 4
Tree...

Share

Given a Binary Tree and a key, write a function that prints all the ancestors of the key in the given binary tree.
For example, consider the following Binary Tree
...

Share

Given an array of numbers, return true if given array can represent preorder traversal of a Binary Search Tree, else return false. Expected time complexity is O(n).
E...

Share

Given two n-ary trees, the task is to check if they are mirror of each other or not. Print “Yes” if they are mirror of each other else “No”...

Share

Given a binary tree, print all the ancestors of a particular key existing in the tree without using recursion.
Here we will be discussing the implementation for the a...

Share