-
0
Question: what is algorithm?
- Keywords:
-
Jacob Leygonie answered on 14 Nov 2019:
Good question!
There are possibly several approaches to talk about algorithms. Let me propose a simple one. An algorithm is a list of instructions. Often, we name the algorithm. The following is an example:
Title of algorithm: Receipt of a strange cake
1) Put 1kg of chocolate in microwave.
2) Mix with eggs and flour.
3) Add butter.
4) Eat.
An algorithm has to be “executed” by someone. The person that executes the algorithm should be able to A) understand the langage of the algorithm; and B) be able to do (execute) each instruction.
For instance, the algorithm “Receipt of a strange cake” can be interpreted and executed by a human being; but could not even be interpreted by a computer. A computer understands only simple langages (with a very small vocabulary): for instance Java, Python, C. These are really langages like english, french or german, but are much simpler, so that it is easy for us human to learn them. If you write an algorithm in one of these langages, i.e. a series of instruction, the computer will be able to interpret it and then execute it.
It is common to insist on the requirement that an algorithm should “terminate”, i.e. that the person/algorithm that executes it should be able to do all the instructions in a finite amount of time. For instance, the following algorithm causes trouble, because it never terminates!
Title of algorithm: Silly algorithm
1) Say “Hello!”.
2) Say “Goodbye!” and go back to instruction 1).
It is also important to ask that the algorithm is “correct”, i.e. that it does what it is expected to do. For instance, if someone asks you to design an algorithm that counts from 1 to 3, then the algorithm “Receipt of a strange cake” will not be correct, but the following one will.
Title: Counting from 1 to 3
1) Say “1”
2) Say “2”
3) Say “3”
Latest Questions
-
Is it difficult programming robot, also what programming language do you use to programme robots
-
Do you think that computers are smart? Or do you think it is humans who are the smart ones?
-
Will any robots ever pass the Turing Test?
-
How important is technology to the advancement of the human race
-
What are your thoughts on simulation theory?
-
what type of experiments do you do
-
Why do you like to use computers a lot?
-
what was your backup job if you were’nt a scientist
-
can robots program themself?
-
What is the hardest thing in your field?
Comments