CHAPTER 1

image

Sorting, Searching, and Merging

In this chapter, we will explain the following:

  • How to sort a list of items using selection and insertion sort
  • How to add a new item to a sorted list so that the list remains sorted
  • How to sort an array of strings
  • How to sort related (parallel) arrays
  • How to search a sorted list using binary search
  • How to search an array of strings
  • How to write a program to do a frequency count of words in a passage
  • How to merge two sorted lists to create one sorted list

1.1 Sorting an Array: Selection Sort

Sorting is the process by which a set of values are arranged in ascending or descending order. There are many ...

Get Advanced Topics in C: Core Concepts in Data Structures 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.