+ 24

{About Pseudocode} Why should we write Pseudocode?

If you are unfamiliar with Pseudocode, it is a high-level language that is supposed to mimic how an application or algorithm would be written in an imperative style. The actual syntax does not matter too much; it is used for discussion, or to write ideas down before implementing them in a real language. Look At Comment!

1st Mar 2017, 1:22 PM
Ram chandra Giri
Ram chandra Giri - avatar
8 Answers
+ 20
For example, writing an algorithm to find the maximum value in a list of positive numbers may look like this: int largest = -1 for i in 1 to length of list if list(i) > largest then largest = list(i) if (largest == -1) print "No positive numbers found in the list" else print "Largest number in the list: " + largest There are no semicolons, and there is no formal syntax; the use of for and if statements rely on the reader having some experience as a programmer. This example could have been written in a number of different ways, but the most important thing is that everyone who reads it understands the intention. Pseudocode is used in situations other than interviews. Technical specifications may use it to provide an outline of how an algorithm should work, or sometimes blog posts or technical articles may use Pseudocode to keep any examples language-independent.
1st Mar 2017, 1:23 PM
Ram chandra Giri
Ram chandra Giri - avatar
+ 17
Design thinking: Just as when you write a paper you need an outline or structure, so when you code you need to take a small amount of time to plan what it is you will do. This plan is pseudocode. Thank you for this important question Mr. Ram. Hatsy awesome example:)
17th Mar 2017, 12:09 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 17
brilliant shane! thank you Phil and Mustafa excellent, very helpful.
17th Mar 2017, 6:37 PM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 13
If thread is good apply upvote apply cookie If has answer to question print answer else If thread is bad apply downvote apply report rob cookie else ignore thread
1st Mar 2017, 2:25 PM
Hatsy Rei
Hatsy Rei - avatar
+ 5
Sometimes you don't express your algorithm with mathematically. Because there may be a complex code or algorithm. Pseudocode simplifies your logical algorithm to your speaking language level.
2nd Mar 2017, 10:58 AM
Mustafa YEMURAL
Mustafa YEMURAL - avatar
+ 5
sometimes you want to discuss or brainstorm bits of code or ideas for code, at a whiteboard, flipchart or just a scrap of paper, and it doesn't matter if a computer can interpret or compile it, the only thing that matters is the general logic is right and that the people in the room understand it. This means you can discuss the logic being used with non-coders, or people who do not know the specific code you are using
2nd Mar 2017, 8:43 PM
Phil
Phil - avatar
+ 4
I often write pseudocode in the ide to plan out my real code. I keep it and turn it into comments so that when I return to the code months later I can remember my thought process.
17th Mar 2017, 5:58 PM
Shane