ProgrammingHard
A heap of 15 nodes stored as an array (complete binary tree) has what height, counting levels from 1?
- A. 3
- B. 5
- C. 15
- D. 4
Correct answer: D. 4
A complete tree with 15 nodes has 4 full levels: 1, 2, 4 and 8 nodes.
More C Programming questions
- A singly linked list is searched for a value with a loop that stops when the value is found. For n nodes, what is the worst-case number of…
- A list with a sentinel head node is used to simplify insertion. What does the sentinel remove the need for?
- A circular buffer of capacity 4 holds 3 items and is written with 2 more. How many items are in it afterwards if the buffer overwrites the…
- A hash table with open addressing and a load factor of 0.9 is used. Why is this risky?
- A chained table uses the key modulo 7 for 7 buckets. Keys 3, 10, 17, 24 are inserted. What is the length of bucket 3?
- A list reversal is done in place, and then the list is traversed to print it. What is the time for the reversal alone on n nodes?