Bubble Sort

  1. Initialize an outer loop to iterate through the entire array. Start with the variable i set to 0.
  2. Within the outer loop, initialize an inner loop to compare adjacent elements in the array. Start with the variable j set to 0.
  3. Compare the j-th element with the (j+1)-th element. If the j-th element is greater than the (j+1)-th element, swap them.
  4. Continue iterating through the array in this manner until the inner loop reaches the end of the array.
  5. After each iteration of the inner loop, the largest unsorted element will "bubble up" to its correct position at the end of the array.
  6. Increment the value of i in the outer loop and repeat the process until the entire array is sorted.