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:
...

Share

Given a Binary Tree, write an iterative function to print Preorder traversal of the given binary tree.
Refer this for recursive preorder traversal of Binary Tree. To...

Share

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 traversal (asked in Amazo...

Share

Consider lines of slope -1 passing between nodes. Given a Binary Tree, print all diagonal elements in a binary tree belonging to same line.
Input : Root of below tree...

Share

Using Morris Traversal, we can traverse the tree without using stack and recursion. The algorithm for Preorder is almost similar to Morris traversal for Inorder.
1......

Share

Given a Binary Tree, find density of it by doing one traversal of it.
Density of Binary Tree = Size / Height
Examples:
Input: Root of following tree
10
/
...

Share

Prerequisite – Inorder/preorder/postorder traversal of tree
Given a binary tree, perform postorder traversal.
Recommended: Please try your approach on {IDE} ...

Share

Consider lines of slope -1 passing between nodes. Given a Binary Tree, print all diagonal elements in a binary tree belonging to same line.
Input : Root of below tree...

Share

Given a binary tree, print boundary nodes of the binary tree Anti-Clockwise starting from the root. For example, boundary traversal of the following tree is “2...

Share

Given a binary tree. Modify it in such a way that after modification you can have a preorder traversal of it using only the right pointers. During modification, you c...

Share