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.
This is a preview of subscription content, log in via an institution.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer-Verlag London
About this chapter
Cite this chapter
Jenkyns, T., Stephenson, B. (2013). Searching and Sorting. In: Fundamentals of Discrete Math for Computer Science. Undergraduate Topics in Computer Science. Springer, London. https://doi.org/10.1007/978-1-4471-4069-6_4
Download citation
DOI: https://doi.org/10.1007/978-1-4471-4069-6_4
Published:
Publisher Name: Springer, London
Print ISBN: 978-1-4471-4068-9
Online ISBN: 978-1-4471-4069-6
eBook Packages: Computer ScienceComputer Science (R0)