Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Latest commit

 

History

History
14 lines (10 loc) · 606 Bytes

README.md

File metadata and controls

14 lines (10 loc) · 606 Bytes

StalinSort

Single pass O(n) sort algorithm. You iterate down the list of elements checking if they're in order. Any element which is out of order is eliminated. At the end you have a sorted list.

Don't use this in production.

Usage

This package provides two extension methods to IEnumerable<T>:

IEnumerable<TElement> StalinSortBy<TElement, TKey>(Func<TElement, TKey> elementSelector);
IEnumerable<TElement> StalinSortByDescending<TElement, TKey>(Func<TElement, TKey> elementSelector);

NuGet