Page 1213 - AP Computer Science A, 7th edition
P. 1213

12. (A) The values of k are consecutively 4, 3, 2, and 1. The values of randIndex are consecutively 3, 2, 0, and 1. Thus, the sequence of swaps and corresponding states of arr will be:
swap arr[4] and arr[3] 1 2 3 5 4 swap arr[3] and arr[2] 1 2 5 3 4 swap arr[2] and arr[0] 5 2 1 3 4 swap arr[1] and arr[1] 5 2 1 3 4

































































































   1211   1212   1213   1214   1215