BUBBLE SORT (Java, C++) | Algorithms and Data Structures

Check that out and it might help you solve the problem. good luck.