Skip to content

Tag Archives: tree-level-order

Write a function to connect all the adjacent nodes at the same level in a binary tree. Example: Input Tree A / \ B C… Read More
Given a Binary Tree and a key, write a function that prints levels of all keys in given binary tree. For example, consider the following… Read More
Given an array of elements, our task is to construct a complete binary tree from this array in level order fashion. That is, elements from… Read More
Given a Binary Tree and a key, write a function that returns level of the key. For example, consider the following tree. If the input… Read More
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… Read More
Given a non-empty binary tree, print the average value of the nodes on each level. Examples: Input : 4 / \ 2 9 / \… Read More
Given a Binary Tree, print the nodes level wise, each level on a new line. Output: 1 2 3 4 5 Recommended: Please solve it… Read More
Find the level in a binary tree which has the maximum number of nodes. The root is at level 0. Examples: Input: Output : 2… Read More
Given the level order traversal of a Complete Binary Tree, determine whether the Binary Tree is a valid Min-Heap Examples: Input : level = [10,… Read More
Given a binary tree, print it vertically. The following example illustrates vertical order traversal.  1 / \ 2 3 / \ / \ 4 5… Read More
Given a Binary Tree having positive and negative nodes, the task is to find the maximum sum level in it. Examples:  Input : 4 /… Read More
Given a binary tree, print nodes of extreme corners of each level but in alternate order. Example: For above tree, the output can be 1… Read More
Perfect Binary Tree using Specific Level Order Traversal in Set 1. The earlier traversal was from Top to Bottom. In this post, Bottom to Top… Read More
Given a Binary Tree, return following value for it. 1) For every level, compute sum of all leaves if there are leaves at this level.… Read More
Given a Perfect Binary Tree like below: (click on image to get a clear view) Print the level order of nodes in following specific manner:… Read More