Skip to content

SortingAlgorithm

snowinmars edited this page Sep 20, 2016 · 2 revisions

SortingAlgorithm

public static void Bogosort<T>(ref IList<T> arr)
    where T : IComparable
public static void BubbleSort<T>(IList<T> array)
    where T : IComparable
public static void InsertSort<T>(IList<T> arr)
    where T : IComparable
public static IList<T> MergeSort<T>(IList<T> array)
    where T : IComparable
public static void SelectionSort<T>(IList<T> arr)
    where T : IComparable

==

Pancake and Quick sorts aren't good on small arrays. cutoffValue is here to optimize this stuff: sort process is going recursively until subarray length is greater that cutoffValue. After this boundary array finishes sorting with InsertSort.

public static void PancakeSort<T>(IList<T> arr, int cutoffValue = 2)
    where T : IComparable
public static void QuickSort<T>(IList<T> arr, uint cutoffValue = 9)
    where T : IComparable

==

public static bool IsArraySorted<T>(IList<T> arr)
    where T : IComparable
Clone this wiki locally