Skip to main content

Chapter 8 Algorithms

It would perhaps be more accurate to call the field of computer science “algorithm science”. Algorithms, step-by-step instructions to solve a problem, are the heart of computer programming and computer science. Any time someone sets out to answer a question that starts “How can I get the computer to…”, that answer will be in the form of an algorithm. Part of learning computer science is learning to think in terms of these algorithms - to recognize common patterns that can be solved with known algorithms and how to express new ones.
In this chapter, we will focus on algorithms for searching a list and sorting one. In addition to being basic useful algorithms, searches and sorts are studied in computer science because they are a relatively simple way to start learning about how to analyze the efficiency of different algorithms. Computer scientists and programmers need to be concerned about not just what is theoretically possible, but how fast different approaches are and what ones are possible in a practical sense (ones that will finish in a reasonable amount of time).