nsol4 - ( n lg n ) work of heapifying after each...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 435, Fall 2001, Jim Calvin Homework #4 Solutions 6.3-3 (Solution in notes.) 6.4-3 If all the elements are equal, heapsort takes Θ( n ) time. Assume that the elements are distinct. Then if the array is in decreasing order, we save the trouble of forming the initial heap (since it is a heap already), but we still have the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ( n lg n ) work of heapifying after each extraction. If the array is initially in increasing order, we have the additional ( n ) work of building the initial heap. 1...
View Full Document

Ask a homework question - tutors are online