Question PSC-ARR-0019
HardWhat will be the output of the following pseudocode?
Integer a[] = {5, 2, 4, 6, 1, 3}
for (each i from 1 to 5)
Integer key = a[i], j = i - 1
while (j >= 0 AND a[j] > key)
a[j + 1] = a[j]
j = j - 1
end while
a[j + 1] = key
end for
Print a[0], a[5]
- A.
6 1
- B.
1 5
- C.
Sign up free to see the answer and a step-by-step explanation.