Data Structures · Question 8 · Medium
Data Structures question 8
A binary tree has height 4, where height is the number of edges on the longest root-to-leaf path. What is the maximum number of nodes it can have?
- 15
- 16
- 31
- 32
Answer and explanation
Answer: C. 31
Explanation: A tree of height h has at most h + 1 levels, holding 1 + 2 + 4 + ... + 2^h = 2^(h+1) - 1 nodes. For h = 4 this is 2^5 - 1 = 31.
Previous: What is the postfix form of the infix expression A + B * C - D ? · Next: What is the value of the postfix expression 6 2 3 + - 3 8 2 / + * ?
Practise data structures
Try a fresh set of data structures questions with an explanation after every answer, free and without signing up: Data Structures practice. Or sit a full placement mock test.
More data structures questions
- Which data structure is used to implement Breadth-First Search (BFS) of a graph?
- An inorder traversal of a Binary Search Tree (BST) lists the keys in which…
- What is the postfix form of the infix expression A + B * C - D ?
- What is the value of the postfix expression 6 2 3 + - 3 8 2 / + * ?
- A circular queue is implemented in an array of size n using front and rear…
- Keys 15, 22, 8 and 29 are inserted in that order into an empty hash table of…
- The preorder traversal of a Binary Search Tree is 50, 30, 20, 40, 70, 60, 80…
- The keys 10, 4, 7, 1 are inserted in that order into an empty array-based…
- How many structurally different binary trees can be formed with exactly 3 nodes?
- Two stacks share a single array arr[0..n-1]. Stack 1 starts at index 0 and…
More technical & programming practice
Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge