Assuming sorting in ascending order from the beginning of the array.
After 1 st pass:
[15, 5, 4, 18, 12, 19, 14, 10, 8, 20] (no changes, 1 first element sorted)
After 2 nd pass:
[5, 15, 4, 18, 12, 19, 14, 10, 8, 20] (1-2 elements sorted)
After 3 rd pass:
[4, 5, 15, 18, 12, 19, 14, 10, 8, 20] (1-3 elements sorted)
Comments
Leave a comment