Question PSC-ARR-0072
HardWhat is the output of this pseudocode?
Integer a[6] = {5, 4, 3, 2, 1, 0}
Integer i, c = 0
for (each i from 0 to 5)
while (a[i] != i)
Integer t = a[a[i]]
a[a[i]] = a[i]
a[i] = t
c = c + 1
end while
end for
Print c
- A.
5
- B.
3
- C.
Sign up free to see the answer and a step-by-step explanation.