CS146
Chris Pollett
Feb 3, 2014
Which of the following statements is true?
1 for j=2 to A.length 2 key = A[j] 3 // Insert A[j] into the sorted sequence A[1..j-1] 4 i = j - 1 5 while i > 0 and A[i] > key 6 A[i+1] = A[i] 7 i = i - 1 8 A[i + 1] = key
At the start of each iteration of the for loop of lines 1-8, `A[1, .. j-1]` consists of the elements originally in `A[1 .. j-1]`, but in sorted order.