engineering recuitment UKPSC Polytechnic Lecturer Mock Test 2024 Algorithms Searching, Sorting and Hashing Sorting
Consider the following array and what is the status of the array after the third pass when we use the bubble sort?
Input: 12, 34,2, 45,1, 25
Output: 1, 2, 12, 25, 34, 45
After the first pass: 12, 2, 34, 1, 25, 45
1
12, 2, 34, 1, 25, 45
2
2, 12, 1, 25, 34, 45
3
2, 1, 12, 25, 34, 45
4
1, 2, 12, 25, 34, 45