First algorithm: Bubble sort.
Bubble sort working