What is Pseudocode Why use Pseudocode Types of Pseudocode Advantages and Disadvantages of Pseudocode.
What is Pseudocode Why use Pseudocode Types of Pseudocode Advantages and Disadvantages of Pseudocode.
What is Pseudocode? (P-CODE)
Pseudocode (pronounced Soo-Doh-Kohd) is made up two words: Pseudo and Code. Pseudo means imitation and code refers to introduction, written in a programming language. As the name suggest, pseudo code is not a real programming code, but it models and may even look like programming code. It is a generic way of describing an algorithm without using any specific programming language related notation. Simply put, pseudo code is an outline of a program, written in a form that can be easily converted into real programming statements. Pseudocode uses plain English statements rather than symbol, to represent the process of a computer program. Pseudo code is also known PDL (Program Design Language), as emphasis’s the design aspect of a computer program or a structured English, because usually pseudo code instruction are written in normal English but in a structured way.
When Pseudocode is detailed yet making readable, it can be inspected by the group of programmers and designer, it’s a technique to ensure that actual programming is likely to matches in design specification. It is better to catch Errors is the pseudo code stage rather than correcting them in later stages, is it would prove expensive. As on the pseudocode is accepted, it is written using the vocabulary and syntax of the chosen programming language. The benefit of pseudo code is , it enables the coder to concentrate on the algorithm without worrying about all the syntactic details of a particular programming language. In fact,If you can write pseudocode without even knowing what programming language you can use for the final implementation. Often Computer textbook use pseudocode in their examples for that all programs can understand them, even if they do not know the same programming languages.
:- programming is a complicated process. Initially, the programmer has to understand the program specifications. Then he need to organised his thought and finally construct the program. This can be a difficult task when the program requirements are complex in nature.
Pseudocode provides a developing method in very simple, the program logic is we used everyday language to prepare a brief set of instruction in the order of in which they will appear in the finished program. it allows the programmer to focus on the steps required to solve a program rather than on how to use the computer languages. In advantages of pseudo code is that it can be used to describe a program to a non technical user and can still provide guidelines for the writing of program code. Moreover, writing Pseudocode saves lot of time later during the construction and testing phase of programs development.
Pseudocode strikes a fine balance between the understand-ability and informality of natural language like English, and the precision of a computer program code. It is somewhat Halfway between English and a programming language. If an algorithm is written in English, the description maybe it’s such a high-level that it may prove difficult to analyse the algorithm and then to transform it into actual code. If instead, the algorithm is written in code, the programmer has to invest a lot of time in determining the details of an algorithmic, which he may choose not to implement. Therefore the goal of writing pseudo code is to provide a high level description of an algorithm, which facilities analysis and eventual coding but at the same time suppresses many of the details that are insignificant.
Pseudo code guidelines:-
Pseudo code guidelines writing pseudo code is not that difficult task. Even if you do not know anything about the computer or computer languages, you can still develop effective and efficient pseudocodes, provided that you are writing in an organised manner. The main purpose of pseudocode is to help the programmer to write efficient program code. You need not to be as specific as in a computer language. Even longish, yet simple statements can generate ample amount of idea for the programmer about how to go about writing an actual code. However, you must honestly attempt to add enough detail and analysis to the pseudocode.
By Nature, pseudo code exist in various forms, the must borrow Syntex from Popular programming language like ( C and FORTRAN). Although there are no established standards for pseudocode construction, here are a few general guidelines for checking your pseudocode:
1. Statements should be written in simple English and should be language independent. Remember that you are only describing the logic plan to develop a program, you are not coding.
2. Steps must be clear, that is, unambiguous and when the steps are followed, they must produce a solution to the specified problem. If the pseudocode is difficult for a person to read or translate into code, then something is wrong with the level of detail you have chosen to use.
3. Be concise, you do not need to worry about programming language Syntax, but can still be precise.
4. Each instruction should be written in a separate line and each statement in pseudocode should Express just one action for the computer. If the task list is properly drawn, then in most cases each task will you correspond to one line of pseudocode.
5. Capitalize keyword such as READ, WRITE, IF, ELSE etc.
6. use only three structures:- Sequence, Selection and Repetition and apply proper indentation to signify particular control structure. End multi-line structure with ENDIF, ENDCASE, ENDDO, etc.
7 Each set of instruction is written from top to bottom, with only one entry and one exit
8. It should allow for easy transition from design to implementation in programming language.
Advantages of using Pseudocode:-
1. Since it is language independent, it can be used by most programmers. It allowed the developer to express the design in plain natural language.
2. It is easier to develop a program from is pseudocode then with a flowchart. Programmers do not have to think about syntaxes or symbols; this simply have to concentrate on the underlying logic. The focus is on the steps required to solve a problem rather than on how to use the computer language.
3.Often, it is easy to translate pseudocode into a programming language, step which can be accomplished by less experienced programmers.
4. The use of words and phrases in the pseudo code, which are inline with basic computer operation, simplify that translation from the pseudo code algorithm to a specific programming language.
5. Unlike flowcharts, pseudocode is compact and does not tend to run over many page. It’s Simple structure and readability makes it is easier to modify as well.
6. Since they are inclined more towards natural languages, pseudocode are self documenting they are easy to generate and maintain using simple word processes. In addition, pseudocode can be reviewed by groups more easily than real code.
7.Pseudocode gives permission to The programmers who work on different computer Programming languages for talking to each other.
Disadvantages of using pseudocode:-
1. The main disadvantages of using pseudo code is that it does not provide visual representation of the programs logic.
2. There are no accepted standards for writing pseudocode. In It Different programmers use their own style of writing pseudocode.
Pseudo-code is a kind of structured English for representing algorithms. It always allows the designer to focus on the logic of the algorithm without being distracted by details of language Syntax. The pseudo code needs to be complete. In It describe to the entire logic of the algorithm so that implementation becomes a more mechanical task for translating line by line into source code.
The ‘Structured’ Part of pseudocode is a notation for representing three general programming constructs Sequence, Selection, and Repeatation. Each of these construct can be embedded inside any other construct. This construct represent the logic of flow of control in an algorithmic. There are three basic constructs for flow of control are sufficient to implement any proper algorithm.
Before going ahead with pseudocode structural, let us discuss some keywords, which are often used to indicate input or output and processing operation.
Input: READ, OBTAIN, GET, and, PROMPT
Output: PRINT, DISPLAY, and SHOW
Compute: COMPUTE, CALCULATE, and, DETERMINE
Initialize: SET, and INITIALIZE
Add one: INCREMENT
:-sequence construct is a linear progression where one task is performed sequentially after another. Sequential control are indicates by writing one action after another, each action on a line by itself, and all action align with the logical indent. The action are performed in the sequence (top to bottom) that they are written.
(Flowchart with Pseudocode for Sequence Construct)
For example, the pseudo code given block calculate the area of a rectangle.
PROMPT the user to entered the height of the rectanglePROMPT the user to entered the width of the rectangleCOMPUTE the area by multiplying the height with widthDISPLAY the areaSTOP
Note:- that the action are flowing in a logical manner, that is, from top to bottom. There is no branching and no process is repeated again. Each process is contributing something to the next process.
:-Selection is a process of deciding which choice is made between two or more alternative course of action. Selection logic is depicted age and IF-THEN-ELSE-ENDIF or CASE-ENDCASE structure. As the name suggests, in case of the IF-THEN-ELSE-ENDIF construct, if the condition is true, the true alternative actions are performed and if condition is false then false alternative actions are performed.
Note:- that the ELSE keyword and ‘Action 2’ are optional. If the condition is true, Action 1 will be performed otherwise Action 2 will be performed. In case you do not want to choose between two alternate course of actions, then simply use IF-THEN-ENDIF.
Hence, if the condition is true then perform the list of actions listed in the IF-THEN-ENDIF construct and then move on to the other actions in the process. In case the condition is false then move on to the rest of the action in the process directly. Let us write a pseudocode to find the largest of three number.:-
READ A, B, and CIF A is greater than B THENIF A is greater than C THENDISPLAY AELSEDISPLAY CENDIFELSEIF B is greater than C THENDISPLAY BELSEDISPLAY CENDIFENDIFSTOP
From the above pseudo code you can see that the IF construct is nested into another IF construct. However, if there are a number of conditions to be checked, then using multiple IFs may look very clumsy. Hence, it is advisable to use the CASE-ENDCASE selection construct for multiple-way selection logic. A CASE construct indicates a multi-way branch based on many conditions. CASE construct uses four keywords, CASE, OF, OTHERS, and, ENDCASE along with conditions that are used to indicate the various alternatives.
REPETITION ‘or’ Looping :-
Repeatation ‘or’ Looping , looping construct is used when some particular task(s) is to be repeated for a number of times according to the specified condition. By using looping, the programmer avoid repeating the same set of instructions. In flowcharting, it is confusing to separate selection from looping. This is because each structure uses the Diamond (decision symbol) as their control symbol. In pseudocode, we avoid this by using specific keywords, namely DO WHILE-ENDO and REPEAT UNTIL, to designate looping.
In case of DO WHILE, the loop will continue as long as the condition is it true. The loop is entered when, only if the condition is true. The ‘sequence’ is performed for each iteration. At the conclusion of every iteration, the condition is evaluated and the loop continue as long as the condition is true. The following pseudocode display the first Ten natural number using to using the DO WHILE looping structure.
INITIALIZE Count to zero DO WHILE Count is greater than or equal to 10ADD 1 to CountPRINT CountENDDOSTOP
After initializing the COUNT to zero, the loop construct begins. Since the value of COUNT is less than 10, the condition stands true. Hence, the statements inside the loop structure are considered. In this structure, the value of COUNT is constantly increasing and as a result, after certain point, that is, after 10 loops, the condition becomes untrue. Hence, The Other statements in the pseudocode are considered.
The REPEAT-UNTIL loop is similar to DO WHILE, expect that the test is performed at the bottom of the loop instead of at the top.
These ‘sequence’ in this type of loop is always perform at least once, because the test is always performed after the sequence is executed. At the conclusion of each iteration, the condition is evaluated, and the loop repeats until the condition gets true. The loop terminates when the condition becomes true.
The flowing pseudocode displays the first 10 natural number using the REPEAT-UNTIL structure.
INITIALIZE Count to zero REPEAT ADD 1 to Count PRINT CountUNTIL Count is less than 10STOP
Dear Reader i hope you will Enjoy this Article , Please give us a valuable feedback for, What is Pseudocode Why use Pseudocode Types of Pseudocode Advantages and Disadvantages of Pseudocode.
What is Pseudocode Why use Pseudocode Types of Pseudocode Advantages and Disadvantages of Pseudocode
Pseudocode (pronounced Soo-Doh-Kohd) is made up two words: Pseudo and Code. Pseudo means imitation and code refers to introduction, written in a programming language. As the name suggest, pseudo code is not a real programming code, but it models and may even look like programming code. It is a generic way of describing an algorithm without using any specific programming language related notation. Simply put, pseudo code is an outline of a program, written in a form that can be easily converted into real programming statements. Pseudocode uses plain English statements rather than symbol, to represent the process of a computer program. Pseudo code is also known PDL (Program Design Language), as emphasis's the design aspect of a computer program or a structured English, because usually pseudo code instruction are written in normal English but in a structured way.
Learn For Free.
T H E S M O L T Learn For Free Download Our Android App in Free DOWNLOAD