Slippery Rock University Dr. Deborah Whitfield Go Browns!

Chapter 7: Advanced Sorts
Data Structures and Algorithms in Java
CpSc 374

Topics
  1. Merge Sorting analysis
  2. Manipulating Odds
  3. Shell Sort
  4. Quick Sort
  5. Radix Sort
  • Sorting Worksheet
  • Sorting Worksheet Solution

    Improve on O(n2) Sorting

    Time Complexity Top

    Manipulating the Odds Top

    Shell Sort
    Selecting the gap sequence
    Knuth Sequence Try the code. Start with this data:
    Strategy
  • Shell sort applied a strategy of moving elements "near" their final location by sorting "striped" subarrays
  • What if we instead move elements so all those bigger than some pivot value are in the top half and all those smaller are in the bottom half?
  • Repeat, recursively
  • Elements are moved to within "half" the array of their final position…
  • Uses partitioning

  • Partioning Data in an Array Partition Issues Top
    Quicksort Code (Hoare) Median of Three Top
    Radix Sort - uses information in keys Top