## Algorithms – Overview

What is an algorithm?

An algorithm is a sequence of well-defined, precise steps for solving a problem. An algorithm needs to terminate and produce an answer. In computer science language, we say that it must terminate in a finite number of steps.

In math classes, algorithms help students learn to multiply and divide, to find the greatest common divisor (GCD), and to solve a system of linear equations.

Computer programs execute algorithms. In a program, the steps of an algorithm are implemented in a programming language. Algorithms and their implementations as a program need to not only terminate but produce the correct result.  As all software written is based on algorithms, algorithms impact our society and economies in profound and lasting ways.

In daily life, we use algorithms to describe solutions to problems and we use them to accomplish tasks (also called computational thinking).

Examples from everyday life:

• Making a peanut butter and jelly sandwich
• More generally, cooking by following a recipe
• Going to the grocery store with a list and walking down every aisle at most once
• Making a snowman
• Playing solitaire
• Wrapping a gift the way it is done at Bloomingdale’s
• Finding a parking spot in a large parking lot (e.g., mall, airport parking)
• Arranging your Netflix movie queue according to your preferences using only the “move to the top” feature
• Every student should be able to come up with an example in their life

In classes students take, algorithms are used to learn skills and to execute procedures in a correct and efficient way.  Examples include

• multiplying and dividing two numbers
• determining the average and median of a given set of numbers
• taking the square root of a number
• finding the greatest common divisor (GCD, Euclid’s Algorithm)
• solving a system of linear equations (Gaussian Elimination)
• evaluating a polynomial (e.g., evaluate 2x4-x3+4x2+12 for x=3)
• determining your schedule of classes for next year based on course offerings, prerequisites, preferences, and graduation requirements.

Algorithms are important in Computer Science

• Every program has an underlying algorithm that it implements
• For every problem there typically exist a number of algorithms solving it. The algorithms may differ considerably in the problem-solving approach taken, the resources needed (including time and space), and other requirements.
• Designing algorithms is a creative intellectual activity.
• There exist a number of common algorithm design techniques that work for many problems. However, the process of finding an algorithm solving a specific problem cannot be automated.
• The execution of incorrect algorithms in a program can lead to wrong results, systems failure, loss of investments, and loss of life.

Algorithmic Thinking

Algorithmic thinking refers to our ability solving problems in an effective way leading to an algorithm. Algorithmic thinking also includes the ability to understand that some problems cannot be solved by an algorithm. It involves

• the ability to specify a problem precisely
• the ability to create and describe an algorithm to solve the problem