How should I sort a doubly linked list the D way?
mail at skoppe.eu
Tue Aug 13 19:08:57 UTC 2019
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)
Yeah, very likely. Although in this case there already is an
array; it's going to be close :)
More information about the Digitalmars-d-learn