Skip to main content

Sorting and Searching

  • Chapter
The Algorithm Design Manual

Abstract

Typical computer science students study the basic sorting algorithms at least three times before they graduate:first in introductory programming,then in data structures, and finally in their algorithms course.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

eBook
USD 18.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

') var buybox = document.querySelector("[data-id=id_"+ timestamp +"]").parentNode var buyingOptions = buybox.querySelectorAll(".buying-option") ;[].slice.call(buyingOptions).forEach(initCollapsibles) var buyboxMaxSingleColumnWidth = 480 function initCollapsibles(subscription, index) { var toggle = subscription.querySelector(".buying-option-price") subscription.classList.remove("expanded") var form = subscription.querySelector(".buying-option-form") var priceInfo = subscription.querySelector(".price-info") var buyingOption = toggle.parentElement if (toggle && form && priceInfo) { toggle.setAttribute("role", "button") toggle.setAttribute("tabindex", "0") toggle.addEventListener("click", function (event) { var expandedBuyingOptions = buybox.querySelectorAll(".buying-option.expanded") var buyboxWidth = buybox.offsetWidth ;[].slice.call(expandedBuyingOptions).forEach(function(option) { if (buyboxWidth <= buyboxMaxSingleColumnWidth && option != buyingOption) { hideBuyingOption(option) } }) var expanded = toggle.getAttribute("aria-expanded") === "true" || false toggle.setAttribute("aria-expanded", !expanded) form.hidden = expanded if (!expanded) { buyingOption.classList.add("expanded") } else { buyingOption.classList.remove("expanded") } priceInfo.hidden = expanded }, false) } } function hideBuyingOption(buyingOption) { var toggle = buyingOption.querySelector(".buying-option-price") var form = buyingOption.querySelector(".buying-option-form") var priceInfo = buyingOption.querySelector(".price-info") toggle.setAttribute("aria-expanded", false) form.hidden = true buyingOption.classList.remove("expanded") priceInfo.hidden = true } function initKeyControls() { document.addEventListener("keydown", function (event) { if (document.activeElement.classList.contains("buying-option-price") && (event.code === "Space" || event.code === "Enter")) { if (document.activeElement) { event.preventDefault() document.activeElement.click() } } }, false) } function initialStateOpen() { var buyboxWidth = buybox.offsetWidth ;[].slice.call(buybox.querySelectorAll(".buying-option")).forEach(function (option, index) { var toggle = option.querySelector(".buying-option-price") var form = option.querySelector(".buying-option-form") var priceInfo = option.querySelector(".price-info") if (buyboxWidth > buyboxMaxSingleColumnWidth) { toggle.click() } else { if (index === 0) { toggle.click() } else { toggle.setAttribute("aria-expanded", "false") form.hidden = "hidden" priceInfo.hidden = "hidden" } } }) } initialStateOpen() if (window.buyboxInitialised) return window.buyboxInitialised = true initKeyControls() })()

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Bibliography

  1. T. Cormen, C. Leiserson, R. Rivest, and C. Stein. Introduction to Algorithms. MIT Press, Cambridge MA, second edition, 2001.

    MATH  Google Scholar 

  2. J. Komlos, Y. Ma, and E. Szemeredi. Matching nuts and bolts in o(n log n) time. In Proc. 7th Symp. Discrete Algorithms (SODA), pages 232–241, 1996.

    Google Scholar 

  3. D. Knuth. The Art of Computer Programming, Volume 3: Sorting and Searching. Addison-Wesley, Reading MA, second edition, 1998.

    Google Scholar 

  4. R. Motwani and P. Raghavan. Randomized Algorithms. Cambridge University Press, New York, 1995.

    MATH  Google Scholar 

  5. M. Mitzenmacher and E. Upfal. robability and Computing: Randomized Algorithms and Probabilistic Analysis. Cambridge University Press, 2005.

    Google Scholar 

  6. G. Rawlins. Compared to What? Computer Science Press, New York, 1992.

    Google Scholar 

  7. S. Skiena. Encroaching lists as a measure of presortedness. BIT, 28:775–784, 1988.

    Article  MathSciNet  Google Scholar 

  8. V. Strassen. Gaussian elimination is not optimal. Numerische Mathematik, 14:354–356, 1969.

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Steven S. Skiena .

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag London Limited

About this chapter

Cite this chapter

Skiena, S.S. (2012). Sorting and Searching. In: The Algorithm Design Manual. Springer, London. https://doi.org/10.1007/978-1-84800-070-4_4

Download citation

  • DOI: https://doi.org/10.1007/978-1-84800-070-4_4

  • Publisher Name: Springer, London

  • Print ISBN: 978-1-84800-069-8

  • Online ISBN: 978-1-84800-070-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics