Searching and Sorting

This chapter explores two very practical problems: searching and sorting. We consider Linear Search and (two versions of) Binary Search. Binary trees are used to describe the search process. Binary search is much, much better but requires sorted input. We give examples of several sorting strategies: selection sorts, exchange sorts, and partition sorts. A binary tree produces a lower bound on the number of key comparisons that must be done in a worst case and in the average case.