This preview shows page 1. Sign up to view the full content.
Unformatted text preview: clearer. Is the modied algorithm faster than ( NlogN ) in the best case? Why or why not? 3. Do problem 7.31 from the text for insertion sort, bubble sort, mergesort, and quicksort. If there is an obvious and easy way to make the sort stable, assume that it is part of the algorithm and state what it is. 4. Consider problem 7.38 from the text. (a) Give a clearly O ( N ) algorithm for nding the median. (b) Now give an algorithm that is O ( logN ), as asked in the text. Be sure to include an argument for why your algorithm is O ( logN ). Note that A and B represent sets in this problem. You may assume that there are no duplicate elements in A and that there are no duplicate elements in B. 5. Give a format argument, based on the denition of Big Theta, proving that f ( N ) = 3 N 27 N + 5 is ( N 2 ). 1...
View Full
Document
 Spring '08
 M.McCullen
 Algorithms, Data Structures

Click to edit the document details