Searching, Sorting, and Merging

In this chapter, we will explain the following:

  • How to search a list using sequential search
  • How to sort a list using selection sort
  • How to sort a list using insertion sort
  • How to sort a list of strings
  • How to sort parallel arrays
  • How to search a sorted list using binary search
  • How to merge two sorted lists

9.1 Sequential Search

In many cases, an array is used for storing a list of information. Having stored the information, it may be required to find a given item in the list. For example, an array may be used to store a list of the names of 50 people. It may then be required to find the position in ...

Get Learn to Program with C now with the O’Reilly learning platform.

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