Construct a binary heap from an array by processing internal nodes backwards, applying sift down at each. The complete binary tree shape ensures that the subtrees below the current node have already been repaired. The number of nodes whose height is at least is at most , so charging each repair by its height gives total work at most a constant multiple of . The construction takes time in either heap orientation, whereas inserting entries separately has an worst-case bound.
Articles by others on the same topic
There are currently no matching articles.