Shell Sort.
Generalization of insertion sort that allows exchanges of elements far apart using a gap sequence.
Time complexity:
Depends on gap sequence
Average: around O(n log² n)
Worst: O(n²)
Space complexity:
O(1)
Sorts the array using natural ordering.
Sorts the array using the provided comparator.