On Tuesday, 13 August 2019 at 18:28:35 UTC, Ali Çehreli wrote:
On Tuesday, 13 August 2019 at 14:04:45 UTC, Sebastiaan Koppe
> wrote:
> Convert the nodes into an D array, sort the array with > nodes.sort!"a.x < b.x" and then iterate the array and repair > the next/prev pointers.

If possible, I would go further and ditch the linked list altogether: Just append the nodes to an array and then sort the array. It has been shown in research, conference presentations, and in personal code to be the fasted option is most (or all) cases.


Yeah, very likely. Although in this case there already is an array; it's going to be close :)

Reply via email to