| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Tensort.OtherSorts.Mergesort
Description
This module provides an implementation of the mergesort algorithm suitable for sorting lists using the Sortable type.
Documentation
mergesort :: Sortable -> Sortable Source #
Takes a Sortable and returns a sorted Sortable using a Mergesort algorithm.
Examples
>>>mergesort (SortBit [16, 23, 4, 8, 15, 42])SortBit [4,8,15,16,23,42]
>>>mergesort (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)]