Re: Shuffling a linked list
- From: "Stephen Howe" <sjhoweATdialDOTpipexDOTcom>
- Date: Fri, 29 Dec 2006 18:29:10 -0000
There may well be a more elegant O(n*log n) algorithm but doesn't occur
to me offhand.
What about using quick sort for linked lists but suppy a compare which gives
a random result on comparison?
Unless it breaks the quick sort, net result will be it will be randomly
shuffled.
And since quick sort for linked lists is O(n * log n), so will the shuffle
Stephen Howe
.
- Follow-Ups:
- Re: Shuffling a linked list
- From: Googmeister
- Re: Shuffling a linked list
- References:
- Shuffling a linked list
- From: A. Farber
- Re: Shuffling a linked list
- From: Pascal Bourguignon
- Re: Shuffling a linked list
- From: Richard Harter
- Shuffling a linked list
- Prev by Date: Re: Shuffling a linked list
- Next by Date: Re: Shuffling a linked list
- Previous by thread: Re: Shuffling a linked list
- Next by thread: Re: Shuffling a linked list
- Index(es):
Relevant Pages
|