Section 1.2 Algorithms
If problem solving is a central part of computer science, then the solutions that you create through the problem solving process are also important. In computer science, we refer to these solutions as algorithms. An algorithm is a step by step list of instructions that if followed exactly will solve the problem under consideration.
Our goal in computer science is to take a problem and develop an algorithm that can serve as a general solution. Once we have such a solution, we can use our computer to automate the execution. As noted above, programming is a skill that allows a computer scientist to take an algorithm and represent it in a notation (a program) that can be followed by a computer. These programs are written in programming languages.
Check your understanding
To think like a computer.
- Computers do not think, they only do what we humans tell them to do via programs.
To be able to write code really well.
- While it is necessary for most computer scientists to know how to write code, it is not the most important skill.
To be able to solve problems.
- Computer scientists are all about solving problems. We use computers to automate solutions to problems and to do things faster and more accurately than we can do by hand or manually.
To be really good at math.
- Computer science and math are similar in many ways and it helps to have a strong mathematical foundation, but you do not have to be good at math to be a good computer scientist.
What is the most important skill for a computer scientist?
A solution to a problem that can be solved by a computer.
- While it is true that algorithms often do solve problems, this is not the best answer. An algorithm is more than just the solution to the problem for a computer. An algorithm can be used to solve all sorts of problems, including those that have nothing to do with computers.
A step by step list of instructions that if followed exactly will solve the problem under consideration.
- Algorithms are like recipes: they must be followed exactly, they must be clear and unambiguous, and they must end.
A series of instructions implemented in a programming language.
- Programming languages are used to express algorithms, but an algorithm does not have to be expressed in terms of a programming language.
A special kind of notation used by computer scientists.
- Computer scientists sometimes use a special notation to illustrate or document an algorithm, but this is not the definition of an algorithm.
An algorithm is: