Can anyone explain pseduocode? so that a beginner can write it
pritaeas 1,949
Can anyone explain pseduocode? so that a beginner can write it
Pseudocode is just free-form language that you use in a precise way to mimic some conventional programming language. Generally the only requirement is that it should be clear what you intend to do, all your symbols should be defined, and you shouldn't do anything "magical" (like have a line that says "find the inverse of matrix A" if the algorithm is supposed to be finding inverses of matrices. Basically, don't presuppose the conclusion, show all the steps, and explain how it can be done algorithmically. For example:
add integers a and b and put the result in c.
if c is at least equal to twenty then return true;
otherwise return false.
c <- a + b
if c >= 20 return true else return false
These are both valid examples of pseudocode. The point of pseudocode is that you can write programs without worrying about a specific language's funny syntax. You choose the syntax, make sure the semantics are relatively clear in the given context, and worry about getting the solution right; ideally, you should be able to produce real code from pseudocode without having too many "how on earth do I do step 7?" moments.