How can you Merge sort a .Net framework LinkedList (of T)

Posted by Andronicus on Stack Overflow See other posts from Stack Overflow or by Andronicus
Published on 2011-01-04T01:47:03Z Indexed on 2011/01/04 1:54 UTC
Read the original article Hit count: 188

Filed under:
|
|
|

There's a few questions discussing Merge sorting a LinkedList, but how can I do it with the C# LinkedList?

Since the LinkedListNode Next and Previous properties are read-only most of the in-place algorithms I've come across are not possible.

I've resorted to removing all the nodes, sorting them with a .OrderBy(node => node.Value) and then re-inserting them into the Linked list, but it's fairly crude.

© Stack Overflow or respective owner

Related posts about c#

Related posts about algorithm