Search found 1 match

przez jordana
wtorek, 15 września 2020, 16:29
Dział: JAVA
Topic: Which code block uses bubble sort?
Odpowiedzi: 0
Wyświetlone: 1274

Which code block uses bubble sort?

Hey, May I know which one is bubble sort from here: 1) for(int i=0;i<n-1;i++) for(int j=n-1; j>i;j--) if(a[j] < a[j-1]) swap(a[j], a[j-1]); 2) for(int i=0; i<n-1; i++) for(int j=i+1; j<n; j++) if(a[j] < a[i]) swap(a[j],a[i]); 3) int temp, i, j = 0; boolean swaped = true; while (swaped) { swaped = fa...