tensort-1.0.1.3: Tunable sorting for responsive robustness and beyond
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Tensort.Subalgorithms.Magicsort

Description

This module provides the magicsort function for sorting Sortable lists

Synopsis

Documentation

magicsort :: Sortable -> Sortable Source #

Takes a Sortable and returns a sorted Sortable.

Runs both Permutationsort and Bogosort on the input Sortable and compares the results. If the results agree, returns the result of Permutationsort, otherwise repeats the process.

Examples

Expand
>>> magicsort (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>> magicsort (SortRec [(1, 16), (5, 23), (2, 4) ,(3, 8), (0, 15), (4, 42)])
SortRec [(2,4),(3,8),(0,15),(1,16),(5,23),(4,42)]