Bubble Sort

We certainly like it when things are organized. Having data assembled in a particular order makes it substantially easier to glean information from that data; for example, having all the test scores for a classroom of students makes it easy to figure out where the median score lies if and only if those test scores are arranged in a sorted order. But data rarely arrives in a sorted order. In this section, you will start to consider what sorting is and what the costs of sorting data might be as well as a basic approach to sorting that narrows the scope of our problem to focusing on ordering just two elements at a time, instead of an entire array at a time. This approach is very straightforward, but possibly at the expense of making an inordinate number of swaps just to put one single element into position.