So I was going through different sorting algorithms. But almost all the sorting algorithms require 2 loops to sort the array. The time complexity of Bubble sort & Insert
Single loop array sort:
for(int i = 0, j=i+1; i < arr.length && j arr[j]) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; i=0; j=i+1; } else { i++; j++; } }