KnowledgeBoat Logo
|
LoginJOIN NOW

Computer Applications

The following array of integers is to be arranged in ascending order using the bubble sort technique:

26 21 20 23 29 17

Give the contents of the array at the end of each iteration. Do not write the algorithm.

Java Arrays

5 Likes

Answer

The contents of the array at the end of each iteration are as follows:

Itr 126, 21, 20, 23, 29, 17
Itr 2 — 21, 26, 20, 23, 29, 17
Itr 3 — 21, 20, 26, 23, 29, 17
Itr 4 — 21, 20, 23, 26, 29, 17
Itr 5 — 21, 20, 23, 26, 29, 17
Itr 621, 20, 23, 26, 17, 29
Itr 7 — 20, 21, 23, 26, 17, 29
Itr 8 — 20, 21, 23, 26, 17, 29
Itr 9 — 20, 21, 23, 26, 17, 29
Itr 1020, 21, 23, 17, 26, 29
Itr 11 — 20, 21, 23, 17, 26, 29
Itr 12 — 20, 21, 23, 17, 26, 29
Itr 1320, 21, 17, 23, 26, 29
Itr 14 — 20, 21, 17, 23, 26, 29
Itr 1520, 17, 21, 23, 26, 29
Itr 16 — 17, 20, 21, 23, 26, 29

Answered By

3 Likes


Related Questions