Sorting algorithms are procedures used to arrange a data set into an order (usually ascending).
A bubble sort starts at the beginning of the data set. It then goes through it sequentially, checking each item against the next one. If the first item is greater than the second one, they are swapped. This is repeated until it reaches the end of the data set. It then makes a second pass, doing the same thing. Once it makes one full pass without making any changes, it terminates because the list is in order.
A merge sort starts by dividing the list in half repeatedly, until it is left with individual elements. It then merges these elements into pairs, with the smallest element on the left-hand side. This is repeated until all of the sublists are merged into one, which is now ordered.
Bubble sorts are extremely inefficient, whereas merge sorts are very fast. However, merge sorts need additional storage because there are many more stages.