/
Shuffle an Array Shuffle a deck of cards. Shuffle an Array Shuffle a deck of cards.

Shuffle an Array Shuffle a deck of cards. - PowerPoint Presentation

josephine
josephine . @josephine
Follow
67 views
Uploaded On 2023-09-23

Shuffle an Array Shuffle a deck of cards. - PPT Presentation

In i th iteration choose a random element from remainder of deck and put at index i choose random integer r between i and N1 swap values in positions r and i 4 5 6 7 2 ID: 1020277

choose random integer deck random choose deck integer shuffle index positions values 1swap remainder put 23450189array element iteration ith

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Shuffle an Array Shuffle a deck of cards..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and i45672310JValue8923450189Array index6792random integer = 7

2. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and i45679310JValue8223450189Array index6753random integer = 3

3. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and i43679510JValue8223450189Array index67J4random integer = 9

4. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and iJ36795104Value8223450189Array index6743random integer = 9

5. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and iJ46795103Value8223450189Array index6786random integer = 6

6. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and iJ48795103Value6223450189Array index6737random integer = 9

7. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and iJ48395107Value6223450189Array index67106random integer = 8

8. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and iJ4839567Value10223450189Array index6772random integer = 9

9. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and iJ4839562Value10723450189Array index676random integer = 8

10. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and iJ4839562Value10723450189Array index672random integer = 9

11. Shuffle an ArrayShuffle a deck of cards.In ith iteration, choose a random element from remainder of deck and put at index i.choose random integer r between i and N-1swap values in positions r and iJ4839562Value10723450189Array index67