Skip to content

Studio-23-xyz/YetAnotherSortingLibrary

Yet Another Sorting Library

Just as the name suggests this is just another sorting library for .Net Core.

Security Rating Technical Debt

Available Algorithms

Description Done Comment Description Done Comment
Bubble Sort Cocktail Sort
Insertion Sort Shell Sort
Merge Sort Recursive Heap Sort
Quick Sort Recursive Gnome Sort
Selection Sort Pancake Sort

How to use

 int[] UnsortedArray = new[] {1, 5, 6, 2, 4, 3};
 SortDotNet<int>.Sort(UnsortedArray, SortType.Bubble, SortOrder.Decending);

Real Use Case

Implement IComparable Interface to your model class

public class Product:IComparable<Product>
    {
        public string Id;
        public string Name;
        public float Cost;
        public float Price;

        public int CompareTo(Product other)
        {
            if (Cost > other.Cost) return 1;
            if (Cost < other.Cost) return -1;
            return 0;
        }
    }

Use it just like you would for Base Types

 SortDotNet<Product>.Sort(UnsortedArray, SortType.Bubble, SortOrder.Decending);

Implementation Credits : https://rosettacode.org/wiki/Category:Sorting_Algorithms

Sonarcube wip