Selection Sort: C

Next up in my “learning in public” push is selection sort, and an implementation in C. Like insertion sort, selection sort sorts the array in place, starting with a sorted beginning portion and an unsorted end. We iterate through the unsorted portion, and find the smallest value. We then swap that element with the first element in the unsorted portion. From there, the unsorted portion begins one index later, and we repeat the process until the entire array is sorted.

[Read More]

Insertion Sort: C

In my first post in my “learning in public” push, I’m going to be talking about the insertion sort algorithm and an implemention in C. The general idea of insertion sort is to build a sorted array in place, at the beginning of the original array, shifting the unsorted elements toward the end of the array as necessary. It relies on the fact that an array of length 1 is sorted by definition. [Read More]