In 1959, the American computer scientist Donald Shell invented a technique that can be used to speed
Question:
In 1959, the American computer scientist Donald Shell invented a technique that can be used to speed up many different sorting algorithm. For this project, you will apply Shell’s
method to insertionsort.
The basis of the technique is to get the items to move in big steps (rather than shifting elements to the next-higher index). These big-step shifts are done early in the algorithm, and they tend to put the array in nearly sorted order. Later in the algorithm, we use smaller steps (all the way down to steps of size 1, just like an ordinary insertionsort). But by the time that the small steps are being taken, the array is nearly sorted, and that’s a situation where insertionsort is efficient.
The choice of the step sizes affects the performance of the algorithm, but one sequence that is empirically good starts at n/2, and each subsequent step size is about the previous size divided by 2.2.
The overall pseudocode is given here:
Step by Step Answer: