Sort_Algorithm - UzanR/UzCodingNewLife GitHub Wiki

1.Bubble Sort

Explain

  • Sort an array by desending order.
  • Repeatedly swapping the adjacent elements if they are in wrong order.

Algorithm analysis

BUBBLESORT(A[1,2,...,n]):
for i = 1 to n-1
   for j = i+1 to n
      if A[i] > A[j]
         temp = A[i]
         A[i] = A[j]
         A[j] = tmp
return A[1,2,...,n]
⚠️ **GitHub.com Fallback** ⚠️