TEKsystems interview question

How bubble sort algorithm works?