Given a non-empty binary tree, print the average value of the nodes on each level.
3 5 7
Output : [4 5.5 5]
Given two binary trees, we have to check if each of their levels are anagrams of each other or not.
Level 0 : 1
Level 1 : 3, 2
Level 2 : 5, 4
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
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).
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”...
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...