monus-weighted-search-0.1.0.0: Efficient search weighted by an ordered monoid with monus.
Copyright(c) Donnacha Oisín Kidney 2021
Maintainermail@doisinkidney.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

MonusWeightedSearch.Examples.Sort

Description

Sorting using the Heap monad.

The Heap monad can function like a normal heap (although it does need a Monus instead of just any ordered key), and as such it can implement a normal sorting algorithm.

Synopsis

Documentation

monusSort :: Monus m => [m] -> [m] Source #

O(n log n). Heapsort.

>>> monusSort [5,1,2,3,1,6,3,2,5,7]
[1,1,2,2,3,3,5,5,6,7]