1 / 16

8.Sorting in linear time

8.Sorting in linear time. Hsu, Lih-Hsing. 8.1 Lower bound for sorting. The decision tree model. 8.2 Counting sort. The operation of Counting-sort on an input array A[1..8]. 8.3 Radix sort. Used by the card-sorting machines you can now find only in computer museum. RADIX_SORT( A,d )

jmcalpin
Download Presentation

8.Sorting in linear time

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 8.Sorting in linear time Hsu, Lih-Hsing

  2. 8.1 Lower bound for sorting The decision tree model

  3. 8.2 Counting sort

  4. The operation of Counting-sort on an input array A[1..8]

  5. 8.3 Radix sort Used by the card-sorting machines you can now find only in computer museum. RADIX_SORT(A,d) 1 fori 1 tod 2 do use a stable sort to sort array A on digit i

  6. 8.4 Bucket sort

  7. Analysis The running time of bucket sort is taking expectations of both sides and using linearity of expectation, we have

  8. We claim that We define indicator random variables Xij = I {A[j] falls in bucket i} for i = 0, 1, …, n-1 and j = 1, 2,…,n. thus,

  9. Indicator random variable Xij is 1 with probability 1/n and 0 otherwise, and therefore When k j, the variables Xij and Xik are independent, and hence

  10. We can conclude that the expected time for bucket sort is (n)+n·O(2-1/n)= (n).

More Related