20 Searching and Sorting

Objectives

In this chapter you’ll:

  • Search for a given value in an array using linear search and binary search.

  • Sort an array using insertion sort, selection sort and the recursive merge sort algorithms.

  • Use Big O notation to express the efficiency of searching and sorting algorithms and to compare their performance.

  • Understand the nature of algorithms of constant, linear and quadratic runtime.

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.