| Copyright | (c) Andrey Mulik 2019 |
|---|---|
| License | BSD-style |
| Maintainer | work.a.mulik@gmail.com |
| Portability | portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
SDP.SortM.Insertion
Contents
Description
SDP.SortM.Insertion provides insertion sort - simple sorting algorithm.
Synopsis
- insertionSort :: (LinearM m v e, BorderedM m v i, Ord e) => v -> m ()
- insertionSortBy :: (LinearM m v e, BorderedM m v i) => Compare e -> v -> m ()
- insertionSortOn :: (LinearM m v e, BorderedM m v i, Ord o) => (e -> o) -> v -> m ()
- unsafeInsertionSort :: LinearM m v e => Compare e -> v -> Int -> Int -> Int -> m ()
Insertion Sort
insertionSort :: (LinearM m v e, BorderedM m v i, Ord e) => v -> m () Source #
insertionSort is just synonym for .insertionSortBy compare
insertionSortBy :: (LinearM m v e, BorderedM m v i) => Compare e -> v -> m () Source #
insertionSortBy is naive service sorting procedure, that have O(n^2)
complexity in all cases.
insertionSortOn :: (LinearM m v e, BorderedM m v i, Ord o) => (e -> o) -> v -> m () Source #
insertionSortOn is a version of insertionSortBy that uses a cast function
to compare elements.