Building a heap using insertion We can build a heap by

Chapter 6, Problem 6-1

(choose chapter or problem)

Building a heap using insertion We can build a heap by repeatedly calling MAX-HEAP-INSERT to insert the elements into the heap. Consider the following variation on the BUILD-MAX-HEAP procedure: for Chapter 6 167 BUILD-MAX-HEAP0 .A/ 1 A:heap-size D 1 2 for i D 2 to A:length 3 MAX-HEAP-INSERT.A; Ai/ a. Do the procedures BUILD-MAX-HEAP and BUILD-MAX-HEAP0 always create the same heap when run on the same input array? Prove that they do, or provide a counterexample. b. Show that in the worst case, BUILD-MAX-HEAP0 requires .n lg n/ time to build an n-element heap.

Unfortunately, we don't have that question answered yet. But you can get it answered in just 5 hours by Logging in or Becoming a subscriber.

Becoming a subscriber
Or look for another answer

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back