Queue works on the first in first out manner. So when we traverse the tree so we can put the node in the queue
Note - Linked List can also be used to implement level order traversal, however, doing level order traversal using stack is more efficient
Please login to submit your explanation
You can check your performance of this question after Login/Signup
(2h + 1 - 1)
(2h -1 -1)
Height of tree is h then Full Binary Tree will have
Full binary tree
Complete binary tree
Binary search tree
AVL binary tree
A full binary tree is a binary tree in which every node in the tree has exactly zero or two children.
Click here to read more about types of Binary Trees
There are following types of Binary Trees :
When we want to traverse the tree in inorder traverser, so we follows this sequence. That is Left Root Right.
Check these page here for Rules and Examples
10 11 12 15 18 22 25 35 44 50 64 66 70 90
25 15 10 12 11 22 18 35 50 44 66 70 64 90
25 15 10 12 11 22 18 50 35 44 70 66 64 90
11 12 10 18 15 22 44 35 64 66 90 70 50 25
Rules and Examples of Calculating Inorder, Postorder, Preorder are given here -
You can read more about inorder postorder preorder here
You can read more about Depth, Height, Level etc formulas and definition on this page here
Depth always starts from 0
So answer is 4
You can read more about trees here -
Some articles say the height of the tree starts from 0 and some say 1. Actually the correct answer is 0.
The definition of height is: Height of a node can be defined as the longest path downwards between the root and a leaf.
Clearly, if a tree has only root node then root and leaf are same and distance is 0 right?
If an MCQ Question comes in the exam, it will generally say - Assume Height starts from (0 or 1), if not then learn both below formulas safe side mark whichever is present.
So the height of the tree is 4.
The inorder and preorder traversal are ABDEFCGHJLK and DBFEAGCLJHK respectively.
In inorder traversal we follow the sequence that is Left root right and preorder traversal follow the sequence that is Root Left Right. So that from the preorder traversal we can identify root node so from the inorder traversal all the node which are left side of root node that are come left subtree and all the node which are right side of root node that are come right subtree. Now follow the same process with left and right subtree.
Please login to report
Buy TCS NQT Paid Materials
Join TCS NQT Online Classes
Personalized Analytics only Availble for Logged in users
Analytics below shows your performance in various Mocks on PrepInsta
Your average Analytics for this Quiz
September 10, 2021
Login/Signup to comment