in reply to finding and deleting an element from array

That's kind of inefficient. For each card selected, you compare all remaining cards in the deck with the selected card. Now, considering a deck only has 52 cards, it doesn't really matter (unless you've the deal millions of hands), but the principle curls my toes.

Do what humans normally do: before dealing the cards, shuffle them, then deal from the top. Cutting the deck isn't necessary. ;-)

Abigail

  • Comment on Re: finding and deleting an element from array

Replies are listed 'Best First'.
Re: Re: finding and deleting an element from array
by benn (Vicar) on Sep 05, 2003 at 15:22 UTC
    I suspect that if Abigail-II were shuffling & dealing, I'd demand someone else cut first - been burnt like that before...:)

    Ben