Skip to main content

Searching and Sorting

  • Chapter
  • First Online:
Fundamentals of Discrete Math for Computer Science

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 4437 Accesses

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 to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG, part of Springer Nature

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Jenkyns, T., Stephenson, B. (2018). Searching and Sorting. In: Fundamentals of Discrete Math for Computer Science. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-70151-6_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-70151-6_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-70150-9

  • Online ISBN: 978-3-319-70151-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics