class OptimizedBubbleSort { public static void main(String args[]) { int a[]={7,2,9,3,6,3,7,1,0,2,8}; bubblesort(a); for (int i=0;i a[j+1]) { int temp = a[j]; a[j] = a[j+1]; a[j+1] = temp; is_sorted = false; } } if(is_sorted) return; } } } © 2019 GitHub, Inc.