1 / 26

Efficient Sorting Algorithms for Various Problem Sizes

Explore the time requirements of selection sort, bubble sort, insertion sort, mergesort, quicksort, radix sort, and their growth-rate functions in graphical and tabular forms. Understand worst-case scenarios, recursive calls, partitioning methods, and how these algorithms operate on arrays of varying sizes.

Download Presentation

Efficient Sorting Algorithms for Various Problem Sizes

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. Figure 9.1 Time requirements as a function of the problem size n

  2. Figure 9.2 When n ≥ 2, 3 * n2 exceeds n2 - 3 * n + 10

  3. Figure 9.3a A comparison of growth-rate functions: a) in tabular form

  4. Figure 9.3b A comparison of growth-rate functions: b) in graphical form

  5. Selection Sort Bubble Sort Insertion Sort Mergesort Quicksort Radix Sort Sorting Algorithms

  6. Figure 9.4 A selection sort of an array of five integers

  7. Figure 9.5 The first two passes of a bubble sort of an array of five integers: a) pass 1; b) pass 2

  8. Figure 9.6 An insertion sort partitions the array into two regions

  9. Figure 9.7 An insertion sort of an array of five integers.

  10. Figure 9.8 A mergesort with an auxiliary temporary array

  11. Figure 9.9 A mergesort of an array of six integers

  12. Figure 9.10 A worst-case instance of the merge step in mergesort

  13. Figure 9.11 Levels of recursive calls to mergesort given an array of eight items

  14. Figure 9.12 A partition about a pivot

  15. Figure 9.13 kSmall versus quicksort

  16. Figure 9.14 Invariant for the partition algorithm

  17. Figure 9.15 Initial state of the array

  18. Figure 9.16 Moving theArray[firstUnknown] into S1 by swapping it with theArray[lastS1+1] and by incrementing both lastS1 and firstUnknown

  19. Figure 9.17 Moving theArray[firstUnknown] into S2 by incrementing firstUnknown

  20. Figure 9.18a Developing the first partition of an array when the pivot is the first item

  21. Figure 9.18b Developing the first partition of an array when the pivot is the first item

  22. Figure 9.19 A worst-case partitioning with quicksort

  23. Figure 9.20 A average-case partitioning with quicksort

  24. Figure 9.21 A radix sort of eight integers

  25. Figure 9.22 Approximate growth rates of time required for eight sorting algorithms

More Related