Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.Tensort.Subalgorithms.Rotationsort
Description
This module provides Rotationsort variants for sorting Sortable lists.
| I was having some issues with the swaps for larger input lists, so for now these functions are only implemented for lists of length 3 or less.
Synopsis
Documentation
rotationsort :: Sortable -> Sortable Source #
Takes a Sortable and returns a sorted Sortable using a Rotationsort algorithm.
I was having some issues with the swaps for larger input lists, so for now this function is only implemented for lists of length 3 or less.
Examples
>>>
rotationsort (SortBit [1,3,2])
SortBit [1,2,3]
>>>
rotationsort (SortRec [(3, 1), (1, 3), (2, 2)])
SortRec [(3,1),(2,2),(1,3)]
rotationsortAmbi :: Sortable -> Sortable Source #
Takes a Sortable and returns a sorted Sortable using an Ambidextrous Rotationsort algorithm.
I was having some issues with the swaps for larger input lists, so for now this function is only implemented for lists of length 3 or less.
Examples
>>>
rotationsortAmbi (SortBit [1,3,2])
SortBit [1,2,3]
>>>
rotationsortAmbi (SortRec [(3, 1), (1, 3), (2, 2)])
SortRec [(3,1),(2,2),(1,3)]
rotationsortReverse :: Sortable -> Sortable Source #
Takes a Sortable and returns a sorted Sortable using a Reverse Rotationsort algorithm.
I was having some issues with the swaps for larger input lists, so for now this function is only implemented for lists of length 3 or less.
Examples
>>>
rotationsortReverse (SortBit [1,3,2])
SortBit [1,2,3]
>>>
rotationsortReverse (SortRec [(3, 1), (1, 3), (2, 2)])
SortRec [(3,1),(2,2),(1,3)]
rotationsortReverseAmbi :: Sortable -> Sortable Source #
Takes a Sortable and returns a sorted Sortable using an Ambidextrous Reverse Rotationsort algorithm.
I was having some issues with the swaps for larger input lists, so for now this function is only implemented for lists of length 3 or less.
Examples
>>>
rotationsortReverseAmbi (SortBit [1,3,2])
SortBit [1,2,3]
>>>
rotationsortReverseAmbi (SortRec [(3, 1), (1, 3), (2, 2)])
SortRec [(3,1),(2,2),(1,3)]