Thursday 16 January 2014

Algorithms

The whole concept of programming is based on algorithms. An algorithm is a description that can be used by anyone to solve a problem. When programming a software or part of a software, we basically translate algorithms into a piece of code which is understandable by the machine. We usually first write a Pseudocode, and algorithm written in English (or any other language understandable by humans), then we convert or Pseudocode to a code which machine understands. An example of Pseudocode is this:

For each of the students in class:
  Add 1 to their grades

And the Pseudocode above translated into C++ language, for example, would be this:


int numOfStudents = 152;
for(int i=0; i < numOfStudents; i++){
   students[i] += 1;
}



No comments:

Post a Comment