Hi here is the array sort code i came across.
class Arraysorting { public void bubblesort(Int A[]) { // array elements are : {5,3,8,9,2,1,12,90,15} int i,j,tmp; for (i=0 ; i <10 ; i++) for (j=0; j<9-i-1; j++) { if (A[j] > A[j +1]) { tmp = A[j]; A[j] = A[j +1]; A[j +1] = tmp; } } System.out.println("Array in ascending order is ->"); for (i=0 ; i <10; i++) System.out.println(A[i] + "\n"); } }
here i couldn't understand the use of " (j=0; j<9-i-1; j++)".
If possible also help me understand the program on the whole.