Binary searches only work on lists that are in order. So how do programs get a list in order? How does a program sort a list of items when the user clicks a column heading or otherwise needs something sorted?
There are several algorithms that do this. The two easiest algorithms for sorting are the selection sort and the insertion sort. Other sorting algorithms exist as well, such as the shell, merge, heap, and quick sorts.
The best way to get an idea on how these sorts work is to watch them. To see common sorting algorithms in action visit this excellent web site:
Each sort has advantages ...