Recent questions tagged binary-tree

7 7 votes
7 answers 7 answers
109k
109k views
Level of a node is distance from root to that node. For example, level of root is 1 and levels of left and right children of root is 2. The maximum number of nodes on lev...
0 0 votes
1 1 answer
1.4k
1.4k views
0 0 votes
0 0 answers
681
681 views
A weight balanced tree is a binary tree in which for each node, the no. of nodes in the left subtree is atleast half and at most twice the no. of nodes in the right sub t...
2 2 votes
1 answers 1 answer
1.2k
1.2k views
When searching for the key value 50 in a binary search tree, node containing the key values 10, 30, 40, 70, 90, 120, 150, 175 are traversed, in any order. The number of d...
0 0 votes
1 1 answer
736
736 views
Consider the below code which run on any tree.In-order traversalPost-order traversalPre-order traversalNone of these
0 0 votes
2 answers 2 answers
1.5k
1.5k views
Preorder(root){ Printf("root.data"); Preorder(root.leftsidetree); Preorder(root.rightside);}
0 0 votes
2 2 answers
1.3k
1.3k views
46 46 votes
4 answers 4 answers
7.3k
7.3k views
First, consider the tree on the left. On the right, the nine nodes of the tree have been assigned numbers from the set $\left\{1, 2,\ldots,9\right\}$ so that for every ...
11 11 votes
2 answers 2 answers
2.8k
2.8k views
Let $T$ be a rooted binary tree whose vertices are labelled with symbols $a, b, c, d, e, f, g, h, i, j, k$. Suppose the in-order (visit left subtree, visit root, visit ri...
41 41 votes
2 answers 2 answers
5.4k
5.4k views
Given a binary tree of the following form and having $n$ nodes, the height of the tree is$\Theta \left(\log n\right)$$\Theta \left(n\right)$$\Theta \left(\sqrt{n}\right)$...
11 11 votes
1 answers 1 answer
3.3k
3.3k views
Consider a complete binary tree of height $n$, where each edge is one Ohm resistor. Suppose all the leaves of the tree are tied together. Approximately how much is the ef...
0 0 votes
5 answers 5 answers
3.0k
3.0k views
If I am given an array $X$ of $n$ distinct integers which is interpreted as a complete binary tree, so if the parent is at index $i$, then it's left child would be at ind...
2 2 votes
2 answers 2 answers
1.2k
1.2k views
if two identical elements are present in BST then how inorder can give sorted array as output ?for ex. if 50,30,45,35,56,58,74,50,15 are inserted to make BST.
8 8 votes
2 answers 2 answers
22.0k
22.0k views
Consider the following Binary Search Tree 10 / \ 5 20 / / \ 4 15 30 ...
0 0 votes
1 answers 1 answer
913
913 views
Consider a binary tree having 'n' elements or 'n' nodes the tree is organized in such a way that at every level 'i' there are 'i' nodes assuming root to be at level 1 the...
57 57 votes
14 answers 14 answers
39.4k
39.4k views
Consider a binary tree T that has $200$ leaf nodes. Then the number of nodes in T that have exactly two children are ______.
39 39 votes
4 answers 4 answers
18.6k
18.6k views
The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum number of nodes in a binary tree of height $5$ are$63$ and $6$, respect...
61 61 votes
15 answers 15 answers
44.9k
44.9k views
A binary tree T has $20$ leaves. The number of nodes in T having two children is ______.
0 0 votes
2 2 answers
1.2k
1.2k views
98 98 votes
8 answers 8 answers
38.1k
38.1k views
In a binary tree, for every node the difference between the number of nodes in the left and right subtrees is at most $2$. If the height of the tree is $h 0$, then the m...
31 31 votes
5 answers 5 answers
8.2k
8.2k views
Which one of the following binary trees has its inorder and preorder traversals as $BCAD$ and $ABCD$, respectively?
58 58 votes
3 answers 3 answers
17.3k
17.3k views
An array $X$ of n distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. If the root node is at level $0$, the le...
64 64 votes
6 answers 6 answers
22.1k
22.1k views
An array $X$ of $n$ distinct integers is interpreted as a complete binary tree. The index of the first element of the array is $0$. The index of the parent of element $X[...
77 77 votes
14 answers 14 answers
39.8k
39.8k views
In a binary tree, the number of internal nodes of degree $1$ is $5$, and the number of internal nodes of degree $2$ is $10$. The number of leaf nodes in the binary tree i...
92 92 votes
13 answers 13 answers
33.2k
33.2k views
A group of $15$ routers is interconnected in a centralized complete binary tree with a router at each tree node. Router $i$ communicates with router $j$ by sending a mess...
97 97 votes
9 answers 9 answers
27.1k
27.1k views
A binary tree with $n 1$ nodes has $n_1$, $n_2$ and $n_3$ nodes of degree one, two and three respec­tively. The degree of a node is defined as the number of its neighbou...
71 71 votes
8 answers 8 answers
30.9k
30.9k views
A binary tree with $n 1$ nodes has $n_1$, $n_2$ and $n_3$ nodes of degree one, two and three respec­tively. The degree of a node is defined as the number of its neighbou...
30 30 votes
5 answers 5 answers
12.1k
12.1k views
The following three are known to be the preorder, inorder and postorder sequences of a binary tree. But it is not known which is which.$MBCAFHPYK$$KAMCBYPFH$$MABCKYFPH$Pi...
27 27 votes
3 answers 3 answers
7.2k
7.2k views
Which of the following sequences denotes the post order traversal sequence of the below tree?$f\; e\; g\; c\; d\; b\; a$$g\; c\; b\; d\; a\; f\; e$$g\; c\; d\; b\; f\; e\...
38 38 votes
3 answers 3 answers
17.8k
17.8k views
In the balanced binary tree in the below figure, how many nodes will become unbalanced when a node is inserted as a child of the node “g”?$1$$3$$7$$8$