Overview
In Chapter 2 we introduce the basic concepts of algorithm design and analysis, including
the formalization of the best-case, worst-case, and average complexities of an algorithm.
We also describe some general guidelines for algorithm design, and review the role of
recursion in the design of algorithms. The role of data structures in designing efficient
algorithms is also discussed. A brief overview of the major design strategies for
Chapter Objectives
This chapter establishes the foundation for the design and analysis of algorithms. After
completing the chapter the student will know:
• The importance of the proper choice of a basic operation when analyzing the performance
of a given algorithm
• The importance of an appropriate measure of the input size when analyzing an algorithm
• The formal definitions of best-case, worst-case, and average behavior of algorithms.
• The proper choice of a data structure can impact the efficiency of an algorithm
• The importance of recursion in algorithm design
• The design and performance of some standard comparison-based algorithms for searching
and sorting and finding the maximum and minimum elements in a list
• How the tree of recursive calls can be used to analyze the efficiency of recursive algorithms
such as mergesort and quicksort
Instructor Notes
Parts of this chapter might be review for students having a strong background in data structures.
In any case, we expect the student to be at least familiar with the linear data structures
contained in Appendix B. However, the material in Section 2.5, where the complexities of an
algorithm is formally defined, is critical for the remainder of the text, and should at least be
reviewed carefully. These notions are illustrated by examples which are also probably familiar
to many of the students, but where the complexity analysis might not be as well understood.