Our task is to sort these balls by brightness. This robot, however, is short-sighted, and can only compare balls when they are placed directly in front of its eyes. Bubble sort compares every adjacent pair of balls . . . Moving the brighter ball forward. This brings the brightest ball to the end of the row. where it should be. Another pass is performed on the remaining unsorted balls. And so on . . . Quick sort starts by randomly picking one ball, called a “pivot”. It then rearranges the other balls by comparing them with the pivot: Balls brighter than the pivot are moved to the right, and darker ones to the left. The pivot can now be placed where it should be. Our row of balls is now split into two smaller, unsorted rows. Each is sorted in turn using . . . Quick Sort! Pick a pivot . . . Rearrange the other balls . . . Put back the pivot . . . And so on . . .