Capgemini Interview Question

How does the bubble sort work. Write down the code