Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BUILD-MAX-HEAP(A) 1 A.heap-sizeA.length 2 fori LA. length/2] downto 1 3 MAX-HEAPIFY (A, i) BUILD-MAX-HEAP (A) 1 A.heap-size1 2 for i 2 to A.length 3 MAX-HEAP-INSERT(A,

image text in transcribedimage text in transcribed

BUILD-MAX-HEAP(A) 1 A.heap-sizeA.length 2 fori LA. length/2] downto 1 3 MAX-HEAPIFY (A, i) BUILD-MAX-HEAP (A) 1 A.heap-size1 2 for i 2 to A.length 3 MAX-HEAP-INSERT(A, Ai) (a) Do BuILD-Max-HEAP and Build-MaX-HEAP' always build the same heap when run on the same input array? Prove that they do or provide a counter-example to show that they do not b) The text and lecture notes showed that Build-Max-HEAP requires O(n) time to build an n element heap. Show that there is a worst case where BUILD-MAX-HEAP, requires (n log n) time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

305 mg of C6H12O6 in 55.2 mL of solution whats the molarity

Answered: 1 week ago