Sorts through adjacent comparisons.