Algorithms and Data Structures · Middle · Question 9 of 75

What is a binary heap (min-heap)?

Explanation

The smallest element is always at the root, but the rest are only partially ordered. A heap is usually stored in an array: the children of index i are at 2i + 1 and 2i + 2. The left-smaller rule describes a BST.

Further reading

Problem with a question

Algorithms and Data Structures · Middle · question 9

Test yourself

Take the Algorithms and Data Structures · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz