Post Contents

In this article I’ll be going through algorithms and computational problems. Each with some examples and simple explanations.

## What is an Algorithm?

An algorithm is defined a computational procedure is a that takes inputs and producesย outputs. The are often many different algorithms that solve a single problem.

## What is a Computational Problem?

A computational problem is a general description of how we turn inputs to outputs.

In theoretical computer science, a

computational problemis a mathematical object representing a collection of questions that computers might be able to solve. For example, the problem offactoring

- “Given a positive integer
n, find a nontrivial prime factor ofn.”

### Example

**Problem**: Sort a set of numbers in an ascending order.**Input**: A sequence of numbers {a1, a2, a3, a4, … an}**Output**: A permutation {a’1, a’2, a’3, a’4, … a’n}

Given the following input:ย {1, 9, 2, 4, 5, 7}; we would get the following output: {1, 2, 4, 5, 7, 9}.

## How Do We Express Algorithms?

An algorithm should be expressed in the clearest, most simple and concise manner. The clearest way to express an algorithm may be in a human language such as English. However, if control flow is required then you can make use of pseudo-code to make things more specific and clear.

## How To Express Algorithms in Pseudo-code & Flow Diagrams

I hope that the video up will finish up everything in this post.

Until next time, Josh.