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

Data.Tensort.Subalgorithms.Bogosort

Description

This module provides the bogosort function for sorting lists using the Sortable type

Synopsis

Documentation

bogosort :: Sortable -> Sortable Source #

Takes a Sortable and returns a sorted Sortable using a Bogosort algorithm using the default seed for random generation

Examples

Expand
>>> bogosort (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>> bogosort (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)]

bogosortSeeded :: Int -> Sortable -> Sortable Source #

Takes a seed for use in random generation and a Sortable and returns a sorted Sortable using a Bogosort algorithm

Examples

Expand
>>> bogosortSeeded 42 (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>> bogosortSeeded 24 (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)]