I love democracy

Report a typo

You have been given a random array of integers a and the following piece of pseudocode. Choose what the program below does.

If you're having trouble figuring it out, remember: the main tool of a good programmer - a piece of paper and a pen. Try to reproduce these actions with your hands.

for j in (2, len(a)):
    t = a[j]
    i = j − 1

    while (i >= 1) and a[i] > t:
        a[i + 1] = a[i]
        i = i − 1

    a[i + 1] = t

print(a)
Select one option from the list
___

Create a free account to access the full topic