Chapter 20. Searching and Sorting


With sobs and tears he sorted out Those of the largest size ...

 --Lewis Carroll

Attempt the end, and never stand to doubt; Nothing’s so hard, but search will find it out.

 --Robert Herrick

’Tis in my memory lock’d, And you yourself shall keep the key of it.

 --William Shakespeare

It is an immutable law in business that words are words, explanations are explanations, promises are promises — but only performance is reality.

 --Harold S. Green


In this chapter you’ll learn:

  • To search for a given value in a vector using binary search.

  • To use Big O notation to express the efficiency of an algorithm and to compare the performance of algorithms.

  • To review the efficiency of the selection sort and insertion sort ...

Get Visual C++ 2008: How to Program, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.