Basic Sorting Algorithms


I’m studying for my master’s degree at the moment and in my spare time I rebuilt some of the basic sorting algorithms I learned. There are many more, but I wrote a few of them to gain some insight and because it’s fun :). The algorithms are far from optimized for real-life usage, but the mechanics are correct.

I built the following algorithms:

  • Bubble sort
  • Insertion sort
  • Merge sort
  • Quicksort
  • Quicksort with median 3
  • Randomized Quicksort

All the algorithms are built in such a way that they can sort any object type. To make this possible I used delegates to pass to the algorithms so they can extract the properties of the object that you need to sort on. To show how it works I’ve added a testing solution. It’s a simple console application that sorts arrays of given size and times how long it takes the algorithm to finish.

The source code can be found on Github, or in the downloads (top navigation bar).

If you have any questions, comments are open! 🙂



One thought on “Basic Sorting Algorithms

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s