What is pseudocode?
What is it used for?
How should look and what qualities should have a good pseudocode?
What is pseudocode?
What is it used for?
How should look and what qualities should have a good pseudocode?
What is pseudocode?
Pseudocode is a kind of mixture of code and natural language.
Pseudocode is a compact (often informal) language for describing algorithms using keywords of imperative programming languages, but omitting irrelevant details and specific syntax. Wikipedia
It should be easy to understand, but at the same time writing good pseudocode can be quite a challenge.
What is it used for?
Pseudocode is an attempt to maintain a balance between the comprehensibility of a natural language and the accuracy of the code.
A good pseudocode should:
Ignore irrelevant details
If you think about where in your pseudocode to put a comma - you are doing something wrong.
Omit the obvious
For example, do not specify obvious variable types from the context
Consider Context Expression Отсортировать массив с помощью quicksort - it only makes sense if it is not written in the description of the quicksort algorithm.
And most importantly, watch the result , how your pseudocode works in practice.
If you find that your colleague is not able to parse your pseudocode, or transfer it to PL, then it is probably worth working on pseudocode.
Pseudocode example:
Пузырьковая сортировка: для j от 1 до n-1 для i от 1 до nj если aᵢ < aᵢ₊₁ поменять их местами On mobile devices, the code above may not display correctly: it says a[i]<a[i+1]
Source: https://ru.stackoverflow.com/questions/636546/
All Articles