Mergesort in C

Introduction Quicksort is most people's go to sort function and that's not a bad thing because it's a really good general purpose sorting algorithm. A good implementation is really fast and, being an in place algorithm, it uses very little memory. The big drawback of Quicksort is that it's non-stable. This means there are some … Continue reading Mergesort in C

Quicksort in C

Introduction Quicksort is one of the most common sorting algorithms and one of the most efficient. It's so common that it's part of C89. That said, it's still good to know how it works, its strengths, and it's weaknesses. It takes as a divide and conquer approach to sorting. An element is selected as a … Continue reading Quicksort in C

Byte Swapping in C

Introduction Some times you need to swap bytes. Sometimes you don't. But right now we do. Well, we don't but if we were implementing some sorting functions we'd need a good swap function. Sorting typically doesn't move pointers around, instead it moves the bytes pointed to by the pointer. Generic Swap We only want to … Continue reading Byte Swapping in C