Jess: Data Structures, Week 10

Jessica Morton
Invisible College
Published in
1 min readMar 16, 2015

7.1 Sort the sequence 3, 1, 4, 1, 5, 9, 2, 6, 5 using insertion sort.

7.4 Show the result of running Shellsort on the input 9, 8, 7, 6, 5, 4, 3, 2, 1 using the increments {1, 3, 7}.

7.19 Sort 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5 using quicksort with median-of-three partitioning and a cutoff of 3.

After sorting the first, middle, and last elements:
3, 1, 4, 1, 5, 5, 2, 6, 5, 3, 9

Thus the pivot is 5. Hiding it gives:
3, 1, 4, 1, 5, 3, 2, 6, 5, 5, 9

--

--