Recent questions tagged binary-tree

10 10 votes
1 1 answer
254
254 views
A binary tree has:$1000$ nodes in the left subtree $100$ nodes in the right subtreeHow many nodes are processed before the root in preorder, inorder, and postorder traver...
6 6 votes
1 1 answer
214
214 views
A binary tree has:Left subtree containing $1000$ nodes Right subtree containing $100$ nodesHow many nodes are processed before the root in preorder, inorder, and postorde...
7 7 votes
1 1 answer
181
181 views
Which of the following functions correctly returns the total number of nodes in a binary tree rooted at $\texttt{t}$?int tree_size(TreeNode *t) { if (t == NULL) return 0;...
6 6 votes
1 1 answer
176
176 views
Consider the following binary tree:Which option correctly gives the preorder, postorder, inorder, and level-order traversals?Preorder $:\texttt{9 15 23 12 8 6 2 7 10 5 35...
11 11 votes
1 1 answer
232
232 views
6 6 votes
1 1 answer
197
197 views
A node of a binary tree is called nearly balanced if one of the following holds:The node is a leaf. The node has one child and that child is a leaf. The node has two chil...
6 6 votes
2 2 answers
224
224 views
A complete binary tree is stored in an array using $\mathbf{1}$-based indexing, where the root is stored at index $1$.For a node stored at index $11$, which of the follow...
7 7 votes
1 1 answer
186
186 views
A binary tree has height $4$, where height is measured as the maximum number of edges from the root to a leaf.Can such a binary tree have exactly $8$ leaves?Yes, because ...
2 2 votes
3 3 answers
224
224 views
The inorder and preorder traversal of binary tree are $\mathrm{d}, \mathrm{b}, \mathrm{e}, \mathrm{a}, \mathrm{f}, \mathrm{c}, \mathrm{g}$ and $\mathrm{a}, \mathrm{b}, \m...
7 7 votes
5 5 answers
3.2k
3.2k views
The height of a binary tree is the number of edges in the longest path from the root to a leaf in the tree. The maximum possible height of a full binary tree with $23$ no...
4 4 votes
1 1 answer
1.1k
1.1k views
The height of a binary tree is the number of edges in the longest path from the root to a leaf in the tree.What is the maximum possible height of a full binary tree with ...
1 1 vote
0 0 answers
235
235 views
Self DoubtSuppose there are about n tokens in a input string , each of the token is matched with some production rule, how many total production rules used in the parse t...
1 1 vote
1 1 answer
710
710 views
consider a rooted binary tree with n nodes represented using pointers. What is the best possible upper bound to compute the number of such subtrees , which are full binar...
0 0 votes
1 answers 1 answer
465
465 views
answer is D if i delete root y then surely it will replace with s bec inordr succ. but i'm not getting how enqu. and deq. process pls explain that
2 2 votes
1 1 answer
458
458 views
The maximum and minimum size of an array needed to store a binary tree with $15$ nodes aremaximum : $32767$, minimum : $15$maximum : $16384$, minimum : $16$maximum : $327...
1 1 vote
1 1 answer
327
327 views
 Considering above binary tree, what will be the inorder traversal$\text{BADCEGFH}$$\text{GHFEDCBA}$$\text{BACDEGFH}$$\text{GHFDEBCA}$
2 2 votes
1 1 answer
348
348 views
Arrange the following steps of the Inorder Traversal of Binary Tree in the correct order.Visit the Left subtreeVisit the Root nodeVisit the Right subtreeStart traversing ...
1 1 vote
1 1 answer
402
402 views
We have an array $A$ of $n$ numbers, where $n$ is a power of $2$.We build a full binary tree on top of the array $A.$ The elements of the array are leaves of the tree, nu...
1 1 vote
1 1 answer
296
296 views
We have an array $A$ of $n$ numbers, where $n$ is a power of $2$.We build a full binary tree on top of the array $A.$ The elements of the array are leaves of the tree, nu...
2 2 votes
1 1 answer
197
197 views
Which traversal method can be used to print the nodes of a binary tree in ascending order?Pre-order traversalPost-order traversalIn-order traversalLevel-order traversal
0 0 votes
5 5 answers
643
643 views
Stack size in the case of a balanced Binary Tree is logn (Best Case) and in case of unbalanced Binary Tree is n (Worst Case), what is 'n' here?
2 2 votes
1 1 answer
574
574 views
We have an array $A$ of $n$ numbers, where $n$ is a power of $2$.We build a full binary tree on top of the array $A.$ The elements of the array are leaves of the tree, nu...