Bubble Sorting In c Language
Keep In Mind:- 1. If there are N number of unsorted elements then N-1 number of iteration. 2. Start comparison from left to right. 3. Do comparison only with adjacent elements (left to right). 4. T(n) = O(n2) (worst case) 5. Best case : O(n) 6. Average case : O(n2). Basic Idea:- Given elements in an array: - 2,4,1,5,3,7 . Step 1- Choose 2 and compare with 4 = 2,4 (2<4 no swapping). " 4 " " " 1= 2,1,4 (4>1 swaping done) " 4 " " " 5= 2,1,4,5 (4<5 no swapping) " 5 " ...