Bubble sort is a simple algorithm for arranging in the correct order a string of numbers or other elements. The method works by inspecting, from left to right, each collection of adjacent elements in the series, changing their locations if they are out of order. This process is then replicated by the algorithm until it can run through the whole string and not find two elements that need to be swapped.