Re: Shuffling a linked list
- From: "A. Farber" <Alexander.Farber@xxxxxxxxx>
- Date: 29 Dec 2006 14:17:50 -0800
Hi,
Oliver Wong wrote:
You have 2 lists: an input list and an output list. At the start of the
algorithm, your input list is of length 32, and your output list is of
length 0. At the end of the algorithm, your input list will be length 0 and
your output list will be length 32.
while(there are still cards in the input list) {
choose a card randomly from the input list.
Move that card to the tail of the output list.
}
thanks, but how to "choose a card randomly"?
I can run through all elements (using TAILQ_FOREACH macro) and then?
Regards
Alex
--
http://preferans.de
.
- References:
- Shuffling a linked list
- From: A. Farber
- Re: Shuffling a linked list
- From: Oliver Wong
- 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
|