You are on page 1of 3

Ulysses Urich Duran AI22

Sort the following array contents in descending order.


1.
20 -10 14 78 23 4

a. How many swaps were performed?


- 8 swaps

b. How many passes were performed?


- 4 passes

c. What are the final contents of the array?

78 23 20 14 4 -10
1.
38 44 38 5 47 15 220 540 6

d. How many swaps were performed?


- 20 swaps

e. How many passes were performed?


- 8 passes

f. What are the final contents of the array?

540 220 47 44 38 38 15 6 5

Sort the following array contents in ascending order.


1.
105 24 9 74 20 63

g. How many swaps were performed?


- 9 swaps

h. How many passes were performed?


- 4 passes

What are the final contents of the array?

9 20 24 63 74 105

2.
45 -13 -5 -80 86 7 89

i. How many swaps were performed?


- 7 swaps

j. How many passes were performed?


- 5 passes

What are the final contents of the array?


-80 -13 -5 7 45 86 89

You might also like