20. Searching and Sorting

Objectives

In this chapter you’ll learn:

• To search for a given value in an array using the linear search and binary search algorithm.

• To sort arrays using the iterative selection and insertion sort algorithms.

• To sort arrays using the recursive merge sort algorithm.

• To determine the efficiency of searching and sorting algorithms.

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

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

Outline

20.1 Introduction

20.2

Get C# 2010 for Programmers, Fourth Edition 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.