13 Standard algorithms
Each new program has its own challenges, its own unique features. But the same old
subproblems keep recurring. So, very often at some point in your program you will
have to search for a key value in an ordered collection, or sort some data. These
subproblems have been beaten to death by generations of computer theoreticians and
programmers. The best approaches are now known and defined by standard algorithms.
This chapter presents four of these. Section 13.1 looks at searching for key values.
The next three sections explore various "sorting" algorithms.
The study of algorithms once formed a major part of sophomore/junior level studies
in Computer Science. Fashions change. You will study algorithms in some subsequent
subjects but probably only to a limited extent, and mainly from a theoretical perspective
while learning to analyse the complexity of programs.