bubble short Q1
Bubble short assening order 5 9 8 -2 1 1st titration 4 comparison 2nd itteretion 3 comparison and so on comparison = n-i; public class BubbleSortExample { static void bubbleSort( int [] arr) { int n = arr.length; int temp = 0 ; for ( int i= 0 ; i < n; i++){ for ( int j= 1 ; j < (n-i); j++){ if (arr[j- 1 ] > arr[j]){...
Comments
Post a Comment