What is the average Big-O of Insertion Sort?
O(n2)
What is the best case big O of Selection Sort?
O(n2)
What is the average big O of Shell Sort (according to ZyBooks)?
O(n1.5)
How is Shell Sort slightly faster than Insertion and Selection Sort?
Shell Sort reduces the total number of swaps and comparisons, especially on large arrays.
Sort the following array (into ascending order) using Selection Sort:
[4, 2, 5, 3, 1]
[1, 2, 3, 4, 5]
Sort the following array (into ascending order) using Insertion Sort:
[9, 7, 10, 8, 6]
[6, 7, 8, 9, 10]
After trying to sort the following array (into ascending order) using Shell Sort with gap 2, what does the array look like after we sort the subarrays (but not fully completed the sort):
[24, 11, 14, 13, 22, 26]
11 (1), 13 (3), 26 (5) -> 11 (1), 13 (3), 26 (5) (sorted w insertion)
the new array after initial portion:
[14, 11, 22, 13, 24, 26]
It is still acceptable to use Insertion and Selection Sort on smaller data sets where simplicity is all that matters.