SHARE
algorithms and computational problems
Advertisement

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 problem is a mathematical object representing a collection of questions that computers might be able to solve. For example, the problem of factoring

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

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.

pseudocode flow control
Pseudo-code is great because it is easily understandable.

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.

Advertisement