|
|
|
|
|
by cygx
4990 days ago
|
|
Why not use insertion sort - as an on-line algorithm, it can be used to immediately sort the list as it's build. The implementation is straight-forward: instead of appending new elements to the end of the list, insert them in the correct place. My personal go-to algorithm for linked lists is an unstable merge-sort variant with explicit stack[1] - while not as simple as insertion sort, performance is far superior. [1] https://bitbucket.org/cggaertner/listsort/src/master/listsor... |
|