# Tag Archives: tree-level-order

## Connect Nodes at same Level (Level Order Traversal)

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 »

## Print Levels of all nodes in a Binary Tree

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 »

## Construct a complete binary tree from given array in level order fashion

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 »

## Get level of a node in binary tree | iterative approach

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 »

## Check if all levels of two trees are anagrams or not

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 »

## Averages of Levels in Binary Tree

Given a non-empty binary tree, print the average value of the nodes on each level. Examples: Input : 4 / \ 2 9 / \… Read More »

## Level order traversal line by line | Set 2 (Using Two Queues)

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 »

## Level with maximum number of nodes

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 level order traversal of a Binary Tree, check if the Tree is a Min-Heap

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 »

## Print a Binary Tree in Vertical Order | Set 3 (Using Level Order Traversal)

Given a binary tree, print it vertically. The following example illustrates vertical order traversal. 1 / \ 2 3 / \ / \ 4 5… Read More »

## Find maximum level sum in Binary Tree

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

## Print extreme nodes of each level of Binary Tree in alternate order

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 Specific Level Order Traversal | Set 2

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 »

## Find multiplication of sums of data of leaves at same levels

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 »

## Perfect Binary Tree Specific Level Order Traversal

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 »