gustavo-depaula / stalin-sort

Add a stalin sort algorithm in any language you like ❣️ if you like give us a ⭐️
MIT License
1.51k stars 174 forks source link

Kotlin: inplace sort; naming; minor improvement of the old sort #190

Closed bochkarevko closed 1 year ago

bochkarevko commented 1 year ago

First of all, according to the contributing guideline the sort should be named stalinSort, but was sortComrades.
Then, in Kotlin sort sorts inplace, while sorted returns a new list. So I've made 2 other implementations that follow this convention.
A minor improvement of the exisinting implementation: index is not ractually required, since previous is guaranteed to be not null.
Last but not least: some tests.