Question: a. Prove that for binary heaps, buildHeap does at most 2N2 comparisons between elements. b. Show that a heap of eight elements can be constructed

a. Prove that for binary heaps, buildHeap does at most 2N−2 comparisons between elements.

b. Show that a heap of eight elements can be constructed in eight comparisons between heap elements.

c. Give an algorithm to build a binary heap in 13/8 N + O(logN) element comparisons.

Step by Step Solution

3.48 Rating (178 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a We show that H N which is the sum of the heights of nodes in a complete binary tree of N nodes is N b N where b N is the number of ones in the binar... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

1486-C-S-A(406).docx

120 KBs Word File

Students Have Also Explored These Related Algorithms Questions!