Searching and Sorting

  • Tom Jenkyns
  • Ben Stephenson
Part of the Undergraduate Topics in Computer Science book series (UTICS)


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

Authors and Affiliations

  • Tom Jenkyns
    • 1
  • Ben Stephenson
    • 2
  1. 1.Department of MathematicsBrock UniversitySt. CatharinesCanada
  2. 2.Department of Computer ScienceUniversity of CalgaryCalgaryCanada

Personalised recommendations