Bubble Sort: The Algorithm Anyone Can Understand
The code:
for i in range(len(arr)):
for j in range(len(arr) - 1):
if arr[j] > arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
Compare neighbors. Swap if wrong order. Repeat until sorted.
You can explain this to a 5-year-old. That's bubble sort's only advantage.