Course Module Image

An algorithm is a sequence of instructions/actions to solve some problem. The instructions/actions are short and precise, and there is a small, fixed set of possible instructions/actions. Here is an example algorithm for the problem “How do I get to the bathroom?”

Algorithm for the Bathroom Problem:

  1. Face south
  2. Walk 12 feet
  3. Turn west
  4. Walk 15 feet
  5. Turn south
  6. Walk 21 feet
  7. Turn east
  8. Walk 3 feet

 

In the above algorithm, the allowable instructions/actions are “Face [[direction]]” and “Walk [[X feet]],” where [[direction]] is one of four possible directions of the compass and [[X feet]] is a number.

Key concept: Programming is creating a sequence of instructions/actions from a fixed set of allowed instructions/actions to solve a problem. A computer executes these instructions/action sequences.

The allowable set of instructions/actions is what constitutes a programming language. A real programming language, such as JAVA or Python, has instructions/actions for reading, writing, and manipulating numbers and letters.