bubble sort with a boolean to determine whether array is already sorted
问题 I have following code for bubble sort but its not sorting at all. if I remove my boolean then its working fine. I understand that since my a[0] is lesser than all other elements therefore no swapping is being performed can anybody help me with this. package com.sample; public class BubleSort { public static void main(String[] args) { int a[] = { 1, 2, 4, 5, 6, 88, 4, 2, 4, 5, 8 }; a = sortBuble(a); for (int i : a) { System.out.println(i); } } private static int[] sortBuble(int[] a) { boolean