Practice question · Select all that apply
Select every statement the lesson supports about binary heaps.
Hints
- One option promises an ordering the heap property does not actually impose.
- Ask whether the heap property says anything at all about two sibling nodes.
Show the answer
- A. A heap can be stored in a plain array with no pointers
- B. The extreme element is available at the root in O(1)
- D. Insertion and removal are both O(log n)
- E. In a max-heap every parent is at least as large as its children
Why
Constant-time access to the extreme, logarithmic updates, array storage and the parent-child relation are all stated. Full sorting is not: the property relates parents to children only, leaving siblings and cousins unordered, expecting a sorted sequence is the pitfall the lesson names, and getting one requires repeatedly removing the root.
Practise Heaps and Priority Management
The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Heaps and Priority Management
- A binary heap is far weaker than a binary search tree: it only guarantees each parent beats its children, so…
- The value 45 is inserted into the max-heap stored as 50, 30, 40, 10, 20, 35, 25. Order what happens.
- A binary heap lives in a flat array with no pointers at all, and children are found by arithmetic. Which…