Skip to main content

Algorithms as Precise Procedures

Explains the definition, components, and criteria for correctness of algorithms in computer science and mathematics, including examples like the Max Entry and Fibonacci problems.

Save this reading to your study set

Sign up free

In computer science and mathematics, we often encounter problems that require a systematic way to reach a solution. While we might intuitively know how to solve a problem, translating that intuition into a rigorous, reliable process is the essence of algorithm design. An algorithm is not just a "method"; it is a precise procedure for solving a problem that must work on any valid input, terminate in a finite amount of time, and return a value that satisfies the specified goal.

Defining the Problem: Input and Goal

Before an algorithm can be written, the problem itself must be clearly defined. A problem consists of two fundamental components: the problem input and the goal.

  1. Problem Input: This defines the domain of valid data the algorithm will process. For example, in the "Max Entry Problem," the input is defined as a non-empty finite sequence A=(a1,a2,…,aN)A = (a_1, a_2, \ldots, a_N) of integers, where N≥1N \geq 1.
  2. Goal: This defines what the output must satisfy. For the Max Entry Problem, the goal is to return a value mm such that m∈Am \in A and mm is at least every other entry in AA.

It is important to distinguish between describing a solution and computing it. We can define a mathematical function FF that maps an input to an answer (e.g., F(A)=max⁡(A)F(A) = \max(A)), but the function only tells us what the answer is. The algorithm tells us how to find it.

The Anatomy of an Algorithm

An algorithm is a step-by-step procedure. Because these steps are intended to be read and understood by humans, we often write them in pseudocode—a high-level, code-like language that avoids the strict syntax of specific programming languages.

Keep reading for free.

Create an account to finish this reading and make it part of your study routine.

Continue reading free

Already have an account? Log in

Updated

Study it your way.

Import this reading into your study set to get started with another study mode.

Make it your own.

Keep this reading in a new study set, or add it to one you already use.