Maths encyclopedia and lessons  
Search

Mathematics Encyclopedia and Lessons

 
     
 

Lessons

Popular
Subjects

algebra
arithmetic
calculus
equations
geometry
differential equations
trigonometry
number theory
probability theory
more
 

References

applied mathematics
mathematical games
mathematicians
more
 
 

Pseudocode

Pseudocode is a generic way of describing an algorithm without use of any specific programming language syntax. It is, as the name suggests, pseudo code. It cannot be executed on a real computer else it would be actual code and not pseudocode. It resembles real programming code except that it can be written at any level of detail — from code that could be actual code (with a slightly altered existing compiler), to code that needs a human level intelligence to parse its meaning.

Pseudocode, by nature, exists in various forms, although most borrow syntax from popular programming languages (like C, Lisp, or Fortran). Natural language is used whenever details are unimportant or distracting (by way of example, it is common to see a line of pseudocode "swap a and b" — a task which any programmer knows how to do in 3 lines).

Computer science textbooks often use pseudocode in their examples so that all programmers can understand them, even if they do not all know the same programming languages. Since pseudocode style varies from author to author, there is usually an accompanying introduction explaining the syntax used.

A programmer who needs to implement a specific algorithm, especially an unfamiliar one, will often start with a pseudocode description, and then simply "translate" that description into the target programming language and modify it to interact correctly with the rest of the program.

See also

01-04-2007 01:18:14
The contents of this article are licensed from Wikipedia.org
under the GNU Free Documentation License. How to see transparent copy