1 / 8

CS1020 Data Structures and Algorithms I Lecture Note #14a

CS1020 Data Structures and Algorithms I Lecture Note #14a. K-way Merge Sort. 1 K-way Merge Sort (1/2). Can we make Merge Sort more efficient by dividing by k instead of 2?. [CS1020 Lecture 14a: K-way Merge Sort]. 1 K-way Merge Sort (2/2). 5. 12. 3. 9. 10. 16. 6. 7.

tylerj
Download Presentation

CS1020 Data Structures and Algorithms I Lecture Note #14a

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. CS1020 Data Structures and Algorithms ILecture Note #14a K-way Merge Sort

  2. 1 K-way Merge Sort (1/2) . . . Can we make Merge Sort more efficient by dividing by k instead of 2? [CS1020 Lecture 14a: K-way Merge Sort]

  3. 1 K-way Merge Sort (2/2) 5 12 3 9 . . . 10 16 6 7 [CS1020 Lecture 14a: K-way Merge Sort]

  4. 2 Running time: O(k Nlogk N) N …… N/k N/k … … N/k2 N/k2 N/k2 N/k2 . . . . . . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [CS1020 Lecture 14a: K-way Merge Sort]

  5. 3 Improved K-way Merge Sort 5 12 3 9 . . . 10 16 6 7 [CS1020 Lecture 14a: K-way Merge Sort]

  6. 4 Running time: O(N log2k logk N) N N/k N/k N/k2 N/k2 N/k2 N/k2 . . . . . . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [CS1020 Lecture 14a: K-way Merge Sort]

  7. 4 Running time: O(N log2k logk N) By changing the base, we get O(N log2 N) It is not really an improvement over 2-way Merge Sort But it has real application [CS1020 Lecture 14a: K-way Merge Sort]

  8. End of file

More Related