So far we have learned about different data structures and their performance characteristics. In this chapter, we will begin learning about algorithms, which are the fundamental ways of processing data. Algorithms take a sequence of data as input, process that data, and then return a value or set of values as output.
In this chapter, we discuss sorting algorithms and how to apply them using an array data structure we learned about in the previous chapters. We will explore different algorithms that use comparison sorting and look at both simple sorting and divide and conquer strategies where the entire sorting process can be done in memory. As in Chapter 2, Working with Commonly Used Data Structures, we place importance on visualizing the algorithms we will learn about in this chapter.
The topics covered in this chapter are:
Implementing insertion sort algorithm
Implementing merge sort algorithm
Implementing quick sort algorithm
We'll first look at the insertion sort...