Shell Sort and Quick Sort Flashcards
1
Q
Define
Shellsort
A
Based on insertion sort.
1. Insertion sort widely spaced items.
2. Insertion sort less widely spaced items, and so on
For example, do a sort on items four spaces apart, then 1 space apart.
O(N (logN)^2).
2
Q
Define
Interval/gap sequence
A
The sequence of numbers used to generte the intervals between the numbers sorted in shellsort. Popular method is Knuth’s interval sequence, h = 3 x h +1. Important that these numbers are relatively prime, more likely to intermingle items sorted on previous pass
3
Q
Define
Quicksort
A
Most popular, O(NlogN).
Partitions an array into two subarrays then calls itself recursively to quick sort