LEARNING JOURNAL

I created this learning journal to practice writting and to help me learn by writting everything down. Source code here

1/26/2024

Sort an Array with Shellsort

This is my attempt to solve the problem Sort an array using shell sort.

Basically, what shellsort does is doing insertion sort but with h interval and then decrease h until h = 1; The idea is that because insertion sort works well in an almost sorted array, we can take advantage of it by giving it an almost sorted array. When we divide the array into some smaller sub-array, it is easy to sort. Thus, we do that by using the h interval. Then, the time h become 1 and thus we do insertion sort, the array is almost sorted.