JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitattributes
README.md
_config.yml
algorithm.js
index.html

README.md

NaturalMergeSort

index.html visualises how Natural Merge Sort works in general

algorithm.js is a possible Javascript implementation

Basic idea

Initially sorted elements do not need to be sorted again. In the worst case, Natural Merge Sort has the same speed as Merge Sort.

To simplify understanding, this implementation uses recursion and does not take advantage of all possible optimisations.