A sorting algorithm proposed by Donald Shell in 1959, it is a variant of straight insertion sort that allows records to take long leaps rather than move one position at a time.
Clicking on this step you can see the Create code learningstep of the algorithm.
Everything is awesome!
for(int gap = n/2; gap >= 1; gap /= 2){
for(int i = ; i <= ; ++i) {
for(int j = ; j >= ; --j) {
if(a[] > a[]) {
swap(a[], a[]);
}
else break;
}
}
}
You're awesome! No need for help!