Bogomerge
There are a lot of inefficient algorithms out there.
This algorithm is not one of them.
This sort is similar to Timsort in which mergesort and insertion sort are used.
Instead of using insertion sort, I used a similarly efficient sorting algorithm called bogosort. Like Timsort, it uses the alternative sort if the size does not meet the threshold. The threshold can be any number, but I used Random.rand(3)
for the threshold to keep the algorithm's worst-case performance and worst-case space complexity.
Installation
-
Add the dependency to your
shard.yml
:dependencies: bogomerge: github: your-github-user/bogomerge
-
Run
shards install
Usage
require "bogomerge"
TODO Write usage instructions here
Development
TODO Write development instructions here
Contributing
-
Fork it (https://github.com/your-github-user/bogomerge/fork)
-
Create your feature branch (
git checkout -b my-new-feature
) -
Commit your changes (
git commit -am 'Add some feature'
) -
Push to the branch (
git push origin my-new-feature
) -
Create a new Pull Request
License
Dual-licensed under Apache and MIT