Binary heap: Difference between revisions

Content deleted Content added
Dysprosia (talk | contribs)
Dysprosia (talk | contribs)
m (structure)
Line 1:
[[Category:Trees (structure)]]
'''Binary heaps''' are a particular kind of [[heap]] such that each node only has two children. Binary heaps are commonly represented by [[array]]s of values. For example, the root of the tree could be item 0 in the array, and the children of item ''n'' are the items at 2''n''+1 and 2''n''+2; so item 0's children are items 1 and 2, 1's children are items 3 and 4, etc. This allows you to regard any 1-based array as a possibly-screwed-up heap.