This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: m,n . 4. Binary Insertion Sort: Binary insertion sort is similar to insertion sort, except that: instead of ﬁnding the place to insert a new element using linear search, it does a binary search. Please give an algorithm to do binary insertion sort. Do a time-complexity analysis of your algorithm. 5. Prof Larry suggests to change the quicksort algorithm to: 1 Quicksort( A,i,j ) If i < j , then p =Partition( A,i,j ) Quicksort( A,i,p ) Quicksort( A,p,j ) End Will the above algorithm work? If so, what is the complexity of the algorithm. If not, why not? 6. Draw a decision tree to show that 4 numbers can be sorted using at most 5 comparisons. 2...
View Full Document
This note was uploaded on 01/06/2012 for the course CS 3230 taught by Professor Sanjay during the Fall '10 term at National University of Singapore.
- Fall '10