Timsort

This PR stops using `mergesort` from the BSD(ish) standard library, and instead uses a compatibly-licensed implementation `timsort` which I imported into the source here. (I am not big on maintaining external dependencies.)