Re: Shuffling a linked list



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

.



Relevant Pages

  • Re: IBM 029 keypunch -- 0-8-2 overpunch -- what hex code results?
    ... though obviously there are certain patterns to be ... Of course there is an algorithm. ... Card readers implement it. ...
    (bit.listserv.ibm-main)
  • Re: IBM 029 keypunch -- 0-8-2 overpunch -- what hex code results?
    ... Of course there is an algorithm. ... Card readers implement it. ... For IBM-MAIN subscribe / signoff / archive access instructions, ... send email to listserv@xxxxxxxxxxx with the message: GET IBM-MAIN INFO ...
    (bit.listserv.ibm-main)
  • Re: Shuffling a linked list
    ... Oliver Wong wrote: ... At the end of the algorithm, your input list will be length 0 ... Move that card to the tail of the output list. ... I can run through all elements (using TAILQ_FOREACH macro) and then? ...
    (comp.programming)
  • Re: DOA simulation program
    ... Why when i simulate DOA algorithm that have some ... element array, if i increase the number of the element, error of ... If you're trying to read a book through a card with little holes in it, why does it get easier if you poke more holes in the card? ...
    (comp.dsp)
  • RSA Highspeed decrypting on poor processor.
    ... I'm now programming RSA Algorithm on SH3 device, ... encrypting 128bit block cipher key. ... Using RSA 1024bit Algorithm, ... PC send C to card. ...
    (sci.crypt)