4. 4
Shell Sort – Basic idea
generalization of insertion sort
Create a gap by half the number of array.
Compare the elements and sort.
Repeat sorting until gap become equal to 1.
For gap Donald Knuth..
Start with h = 1
h = 3*h + 1
h > n
h = (h – 1) / 3
5. 5
Shell Sort - example
8 2 5 34 67 1
Total numbers of element 8.
Initialy Gap = 4
7 1 3 54 68 2