Overview
In Chapter 6 we discuss the probabilistic analysis of algorithms. We begin by giving a formal
definition of the notion of average complexity in terms of the expected value of the number τ of
basic operations performed by an algorithm for an input of size n. We then given five
formulations for the average complexity A(n), and discuss conditions under which the various
formulations are appropriate. We illustrate these ideas by analyzing the average complexity of
the algorithms LinearSearch, InsertionSort, QuickSort, MaxMin2, BinarySearch,
SearchBinSrchTree, and LinkOrdLinSrch.
Chapter Objectives
After completing the chapter the student will know:
• The formal definition of the average complexity A(n) of an algorithms in terms of the
expected value of the number of basic operations performed
• Various equivalent formulations of A(n) and conditions determining which of the
Instructor Notes
The material in this chapter is somewhat more sophisticated than the material in the previous
chapters. For example, the analysis of the algorithm LinkOrdLinSrch is fairly involved and the
instructor may wish to omit it depending on the sophistication and background of the students.
On the other hand, the analysis of LinkOrdLinSrch is particularly illustrative of the various
concepts used in determining average behavior. Appendix E provides background material for
the basic probability theory that is used in the definitions and the average analysis of the
algorithms in this chapter. The student might be familiar with this material from taking a first