Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.Tensort.Subalgorithms.Supersort
Description
This module provides functions for creating Supersort variants for adjudicating between 3 sorting algorithms.
Synopsis
Documentation
supersort :: (SortAlg, SortAlg, SortAlg, SupersortStrat) -> Sortable -> Sortable Source #
Used for creating a Supersort algorithm that adjudicates between 3 sorting algorithms.
Takes 3 sorting algorithms and a SuperStrat and returns a SortAlg that adjudicates between the 3 sorting algorithms using the provided SuperStrat.
Examples
>>>
import Data.Tensort.Subalgorithms.Bubblesort (bubblesort)
>>>
import Data.Tensort.Subalgorithms.Permutationsort (permutationsort)
>>>
import Data.Tensort.OtherSorts.Mergesort (mergesort)
>>>
supersort (mergesort, bubblesort, permutationsort, mundaneSuperStrat) (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>>
supersort (mergesort, bubblesort, permutationsort, mundaneSuperStrat) (SortRec [(16, 23), (4, 8), (15, 42)])
SortRec [(4,8),(16,23),(15,42)]
mundaneSuperStrat :: SupersortStrat Source #
Takes 3 SortAlgs and adjudicates between them to find a common result. Optimized for use in Mundane Robustsort variants.
Examples
>>>
import Data.Tensort.Subalgorithms.Bubblesort (bubblesort)
>>>
import Data.Tensort.OtherSorts.Mergesort (mergesort)
>>>
import Data.Tensort.Subalgorithms.Permutationsort (permutationsort)
>>>
supersort (mergesort, bubblesort, permutationsort, mundaneSuperStrat) (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>>
supersort (mergesort, bubblesort, permutationsort, mundaneSuperStrat) (SortRec [(16, 23), (4, 8), (15, 42)])
SortRec [(4,8),(16,23),(15,42)]
magicSuperStrat :: SupersortStrat Source #
Takes 3 SortAlgs and adjudicates between them to find a common result. Optimized for use in Magic Robustsort variants.
Previously we used different SuperStrats for Mundane and Magic Supersorts. Currently there is no need to differentiate, but we keep this here for backwards compatibility and in case this changes again in the future.
Examples
>>>
import Data.Tensort.Subalgorithms.Bubblesort (bubblesort)
>>>
import Data.Tensort.OtherSorts.Mergesort (mergesort)
>>>
import Data.Tensort.Subalgorithms.Permutationsort (permutationsort)
>>>
supersort (mergesort, bubblesort, permutationsort, magicSuperStrat) (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>>
supersort (mergesort, bubblesort, permutationsort, magicSuperStrat) (SortRec [(16, 23), (4, 8), (15, 42)])
SortRec [(4,8),(16,23),(15,42)]