A C# version of the selection sort inspired by the way it’s commonly done in Scala https://github.com/CSGrimey/MiscSnippets/blob/master/Code/Algorithms/SelectionSorter.cs
Following the same theme as the last two posts, here is a Scala style implementation of the insertion sort in C# https://github.com/CSGrimey/MiscSnippets/blob/master/Code/Algorithms/InsertionSorter.cs
The code for this is way simpler than I expected. The bubble sort is supposed to be one of the simplest sorting algorithms, yet the code is a lot more involved than this insertion sort code.
As mentioned in my previous post, I’m planning to apply various popular sort algorithms in C# the way it is done in Scala as a learning tool. Translating forces you to understand more than just copying and staring at it.
Here’s a link to a functional version of the bubble https://github.com/CSGrimey/MiscSnippets/blob/master/Code/Algorithms/BubbleSort.cs