Counting Sort in C#: Linear-Time Sorting for Small Integer Ranges
A stable counting sort in modern C# that handles negative numbers, explains the O(n + k) trade-off and guards against ranges too large to count.
A stable counting sort in modern C# that handles negative numbers, explains the O(n + k) trade-off and guards against ranges too large to count.
Bubble sort in modern C# for any comparable type, with the early-exit check that makes sorted input O(n), plus an honest look at when to use it.
Insertion sort in modern C# for any comparable type, why it beats quick sort on small or nearly sorted arrays, and where .NET itself uses it.
Selection sort in modern C# for any comparable type, a fix for a common mistake in older versions, and the one case where it beats other simple sorts.
Solve the Towers of Hanoi puzzle in C# with a short recursive method, see why it needs 2^n – 1 moves, and return the moves as a sequence.