# Searching and Sorting

Chapter

First Online:

## Abstract

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.

This chapter ends with timing comparisons and a relation between the time and number of key comparisons that anticipates the notion of order of complexity.

## Copyright information

© Springer International Publishing AG, part of Springer Nature 2018