You are on page 1of 3

Ulysses Urich D.

Duran AI22

Sort the following array contents in descending order.


1.
25 20 -8 10 2 3

a. How many swaps were performed?


- 4 swaps

b. How many passes were performed?


- 7 passes

c. What are the final contents of the array?

25 20 10 3 2 -8
2.
2 10 5 22 23 40 220 540 6

d. How many swaps were performed?


- 7 swaps

e. How many passes were performed?


- 8 passes

f. What are the final contents of the array?

540 220 40 23 22 10 6 5 2

3.
20 19 18 56

g. How many swaps were performed?


- 3 swaps

h. How many passes were performed?


- 4 passes

i. What are the final contents of the array?

56 20 19 18
Sort the following array contents in ascending order.
1.
9 28 45 -40 -3 3

j. How many swaps were performed?


- 3 swaps

k. How many passes were performed?


- 6 passes

l. What are the final contents of the array?

-40 -3 3 9 28 45

2.
96 35 74 -1 0 -34 26 5 7

m. How many swaps were performed?


- 8 swaps

n. How many passes were performed?


- 9 passes

o. What are the final contents of the array?

-34 -1 0 5 7 26 35 74 96

You might also like