# 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).

## Chapter Topics:

- 8.1. Algorithms Introduction
- 8.2. Linear Search
- 8.3. Binary Search
- 8.4. Sorting
- 8.5. Selection Sort
- 8.6. Selection Sort Code
- 8.7. Insertion Sort
- 8.8. Insertion Sort Code
- 8.9. Algorithm Efficiency
- 8.10. Big-O
- 8.11. Search Efficiencies
- 8.12. Sorting Efficiency
- 8.13. Estimating With Big-O
- 8.14. Merging
- 8.15. Merge Sort
- 8.16. Merge Sort Efficiency
- 8.17. Merge Sort Compared