Implemented the bubble sort.