Download presentation

Presentation is loading. Please wait.

Published byNyla Nichols Modified over 2 years ago

1
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i 44 55 66 22 33 10 JJ Value88 99 23450189Array index67 99 22 random integer = 7

2
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i 44 55 66 99 33 10 JJ Value88 22 23450189Array index67 55 33 random integer = 3

3
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i 44 33 66 99 55 10 JJ Value88 22 23450189Array index67 JJ 44 random integer = 9

4
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i JJ 33 66 99 55 10 44 Value88 22 23450189Array index67 44 33 random integer = 9

5
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i JJ 44 66 99 55 10 33 Value88 22 23450189Array index67 88 66 random integer = 6

6
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i JJ 44 88 99 55 10 33 Value66 22 23450189Array index67 33 77 random integer = 9

7
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i JJ 44 88 33 99 55 10 77 Value66 22 23450189Array index67 10 66 random integer = 8

8
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i JJ 44 88 33 99 55 66 77 Value10 22 23450189Array index67 77 22 random integer = 9

9
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i JJ 44 88 33 99 55 66 22 Value10 77 23450189Array index67 66 random integer = 8

10
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i JJ 44 88 33 99 55 66 22 Value10 77 23450189Array index67 22 random integer = 9

11
Shuffle an Array Shuffle a deck of cards. n In i th iteration, choose a random element from remainder of deck and put at index i. – choose random integer r between i and N-1 – swap values in positions r and i JJ 44 88 33 99 55 66 22 Value10 77 23450189Array index67

Similar presentations

OK

AP Computer Science. Not necessary but good programming practice in Java When you override a super class method notation.

AP Computer Science. Not necessary but good programming practice in Java When you override a super class method notation.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on power system harmonics Ppt on introduction to object-oriented programming php Ppt on word association test pdf Ppt on earth movements and major landforms in china Ppt on statistics and probability books Ppt on natural resources and conservation lesson Ppt on review of related literature outline Ppt online compressor map Ppt on formation of a company in india Free download ppt on sources of energy for class 10