SlideShare a Scribd company logo
1 of 5
Pseudocode
From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computer science and numerical computation, pseudocode is an informal high-level
description of the operating principle of a computer program or other algorithm. It uses the
structural conventions of a programming language, but is intended for human reading rather than
machine reading. Pseudocode typically omits details that are not essential for human
understanding of the algorithm, such as variable declarations, system-specific code and some
subroutines. The programming language is augmented with natural language description details,
where convenient, or with compact mathematical notation. The purpose of using pseudocode is
that it is easier for people to understand than conventional programming language code, and that
it is an efficient and environment-independent description of the key principles of an algorithm.
It is commonly used in textbooks and scientific publications that are documenting various
algorithms, and also in planning of computer program development, for sketching out the
structure of the program before the actual coding takes place.

No standard for pseudocode syntax exists, as a program in pseudocode is not an executable
program. Pseudocode resembles, but should not be confused with skeleton programs, including
dummy code, which can be compiled without errors. Flowcharts and UML charts can be thought
of as a graphical alternative to pseudocode, but are more spacious on paper.

Contents
       1 Application
       2 Syntax
       3 Mathematical style pseudocode
       4 Machine compilation of pseudo-code style languages
          o 4.1 Natural language grammar in programming languages
          o 4.2 Mathematical programming languages
                   4.2.1 Alternative forms of pseudocode
       5 See also
       6 External links



Application
Textbooks and scientific publications related to computer science and numerical computation
often use pseudocode in description of algorithms, so that all programmers can understand them,
even if they do not all know the same programming languages. In textbooks, there is usually an
accompanying introduction explaining the particular conventions in use. The level of detail of
the pseudo-code may in some cases approach that of formalized general-purpose languages.
A programmer who needs to implement a specific algorithm, especially an unfamiliar one, will
often start with a pseudocode description, and then "translate" that description into the target
programming language and modify it to interact correctly with the rest of the program.
Programmers may also start a project by sketching out the code in pseudocode on paper before
writing it in its actual language, as a top-down structuring approach.

Syntax
As the name suggests, pseudocode generally does not actually obey the syntax rules of any
particular language; there is no systematic standard form, although any particular writer will
generally borrow style and syntax; for example, control structures from some conventional
programming language. Popular syntax sources include Pascal, BASIC, C, C++, Java, Lisp, and
ALGOL. Variable declarations are typically omitted. Function calls and blocks of code, such as
code contained within a loop, are often replaced by a one-line natural language sentence.

Depending on the writer, pseudocode may therefore vary widely in style, from a near-exact
imitation of a real programming language at one extreme, to a description approaching formatted
prose at the other.

This is an example of pseudocode (for the mathematical game bizz buzz):

Fortran style pseudo code       Pascal style pseudo code         C style pseudo code:

                                                                 void function bizzbuzz
program bizzbuzz                procedure bizzbuzz
                                                                 for (i = 1; i<=100; i++)
do i = 1 to 100                 for i := 1 to 100 do
                                                                 {
     set print_number to            set print_number to
                                                                     set print_number to
true                            true;
                                                                 true;
     if i is divisible by           if i is divisible by
                                                                     if i is divisible by
3                               3 then
                                                                 3
         print "Bizz"                    print "Bizz";
                                                                          print "Bizz";
         set print_number                set print_number
                                                                          set print_number
to false                        to false;
                                                                 to false;
     if i is divisible by           if i is divisible by
                                                                     if i is divisible by
5                               5 then
                                                                 5
         print "Buzz"                    print "Buzz";
                                                                          print "Buzz";
         set print_number                set print_number
                                                                          set print_number
to false                        to false;
                                                                 to false;
     if print_number,               if print_number,
                                                                     if print_number,
print i                         print i;
                                                                 print i;
     print a newline                print a newline;
                                                                     print a newline;
end do                          end
                                                                 }
See also category: Articles with example pseudocode

Mathematical style pseudocode
In numerical computation, pseudocode often consists of mathematical notation, typically from
set and matrix theory, mixed with the control structures of a conventional programming
language, and perhaps also natural language descriptions. This is a compact and often informal
notation that can be understood by a wide range of mathematically trained people, and is
frequently used as a way to describe mathematical algorithms. For example, the sum operator
(capital-sigma notation) or the product operator (capital-pi notation) may represent a for loop and
perhaps a selection structure in one expression:


Return

Normally non-ASCII typesetting is used for the mathematical equations, for example by means
of TeX or MathML markup, or proprietary formula editors.

These are examples of articles that contain mathematical style pseudo code:

         Algorithm                         Karmarkar's algorithm
         Conjugate gradient method         Particle swarm optimization
         Ford-Fulkerson algorithm          Stone method
         Gauss–Seidel method               Successive over-relaxation
         Generalized minimal               Symbolic Cholesky decomposition
         residual method                   Tridiagonal matrix algorithm
         Jacobi eigenvalue
         algorithm
         Jacobi method


Mathematical style pseudocode is sometimes referred to as pidgin code, for example pidgin
ALGOL (the origin of the concept), pidgin Fortran, pidgin BASIC, pidgin Pascal, pidgin C, and
pidgin Lisp.

Machine compilation of pseudo-code style languages
Natural language grammar in programming languages

Various attempts to bring elements of natural language grammar into computer programming
have produced programming languages such as HyperTalk, Lingo, AppleScript, SQL, Inform
and to some extent Python. In these languages, parentheses and other special characters are
replaced by prepositions, resulting in quite talkative code. These languages are typically
dynamically typed, meaning that variable declarations and other boilerplate code can be omitted.
Such languages may make it easier for a person without knowledge about the language to
understand the code and perhaps also to learn the language. However, the similarity to natural
language is usually more cosmetic than genuine. The syntax rules may be just as strict and
formal as in conventional programming, and do not necessarily make development of the
programs easier.

Mathematical programming languages
An alternative to using mathematical pseudocode (involving set theory notation or matrix
operations) for documentation of algorithms is to use a formal mathematical programming
language that is a mix of non-ASCII mathematical notation and program control structures. Then
the code can be parsed and interpreted by a machine.

Several formal specification languages include set theory notation using special characters.
Examples are:

       Z notation
       Vienna Development Method Specification Language (VDM-SL).

Some array programming languages include vectorized expressions and matrix operations as
non-ASCII formulas, mixed with conventional control structures. Examples are:

       A programming language (APL), and its dialects APLX and A+.

                             Pseudocode Examples
       An algorithm is a procedure for solving a problem in terms of the actions to be
       executed and the order in which those actions are to be executed. An algorithm is
       merely the sequence of steps taken to solve a problem. The steps are normally
       "sequence," "selection, " "iteration," and a case-type statement.
       In C, "sequence statements" are imperatives. The "selection" is the "if then else"
       statement, and the iteration is satisfied by a number of statements, such as the
       "while," " do," and the "for," while the case-type statement is satisfied by the
       "switch" statement.

       Pseudocode is an artificial and informal language that helps programmers develop
       algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool.
       The rules of Pseudocode are reasonably straightforward. All statements showing
       "dependency" are to be indented. These include while, do, for, if, switch. Examples
       below will illustrate this notion.
       What is pseudocode?
       Pseudocode consists of short, English phrases used to explain specific tasks within a
       program's algorithm. Pseudocode should not include keywords in any specific computer
       languages. It should be written as a list of consecutive phrases. You should not use
       flowcharting symbols but you can draw arrows to show looping processes. Indentation
       can be used to show the logic in pseudocode as well. For example, a first-year, 9th grade
       Visual Basic programmer should be able to read and understand the pseudocode written
       by a 12th grade AP Data Structures student. In fact, the VB programmer could take the
       other student's pseudocode and generate a VB program based on that pseudocode.
       Why is pseudocode necessary?
       The programming process is a complicated one. You must first understand the program
       specifications, of course, Then you need to organize your thoughts and create the
       program. This is a difficult task when the program is not trivial (i.e. easy). You must
       break the main tasks that must be accomplished into smaller ones in order to be able to
       eventually write fully developed code. Writing pseudocode WILL save you time later
       during the construction & testing phase of a program's development.
How do I write pseudocode?
First you may want to make a list of the main tasks that must be accomplished on a piece
of scratch paper. Then, focus on each of those tasks. Generally, you should try to break
each main task down into very small tasks that can each be explained with a short phrase.
There may eventually be a one-to-one correlation between the lines of pseudocode and
the lines of the code that you write after you have finished pseudocoding.
It is not necessary in pseudocode to mention the need to declare variables. It is wise
however to show the initialization of variables. You can use variable names in
pseudocode but it is not necessary to be that specific. The word "Display" is used in some
of the examples. This is usually general enough but if the task of printing to a printer, for
example, is algorithmically different from printing to the screen, you may make mention
of this in the pseudocode. You may show functions and procedures within pseudocode
but this is not always necessary either. Overall, remember that the purpose of pseudocode
is to help the programmer efficiently write code. Therefore, you must honestly attempt to
add enough detail and analysis to the pseudocode. In the professional programming
world, workers who write pseudocode are often not the same people that write the actual
code for a program. In fact, sometimes the person who writes the pseudocode does not
know beforehand what programming language will be used to eventually write the
program.
Example:
Original Program Specification:
Write a program that obtains two integer numbers from the user. It will print out the sum
of those numbers.
Pseudocode:
Prompt the user to enter the first integer
Prompt the user to enter a second integer
Compute the sum of the two user inputs
Display an output prompt that explains the answer as the sum
Display the result
Use this template when typing your pseudocode into MS Word:

More Related Content

Similar to Pseudocode.docx angel

Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014Sandy Smith
 
Math In Business boa
Math In Business boaMath In Business boa
Math In Business boaraileeanne
 
perl 6 hands-on tutorial
perl 6 hands-on tutorialperl 6 hands-on tutorial
perl 6 hands-on tutorialmustafa sarac
 
Regular expressions
Regular expressionsRegular expressions
Regular expressionsRaghu nath
 
"the Bund" language. A PEG grammar.
"the Bund" language. A PEG grammar."the Bund" language. A PEG grammar.
"the Bund" language. A PEG grammar.Vladimir Ulogov
 
Wade not in unknown waters. Part two.
Wade not in unknown waters. Part two.Wade not in unknown waters. Part two.
Wade not in unknown waters. Part two.PVS-Studio
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsRuth Marvin
 
Stringing Things Along
Stringing Things AlongStringing Things Along
Stringing Things AlongKevlin Henney
 
Inheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionInheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionCurtis Poe
 
Encryption is a process of converting a message, image, or any other .pdf
 Encryption is a process of converting a message, image, or any other .pdf Encryption is a process of converting a message, image, or any other .pdf
Encryption is a process of converting a message, image, or any other .pdfrachanaprade
 
Analysis of Godot Engine's Source Code
Analysis of Godot Engine's Source CodeAnalysis of Godot Engine's Source Code
Analysis of Godot Engine's Source CodePVS-Studio
 

Similar to Pseudocode.docx angel (20)

Computation Chapter 4
Computation Chapter 4Computation Chapter 4
Computation Chapter 4
 
Algorithm and psuedocode
Algorithm and psuedocodeAlgorithm and psuedocode
Algorithm and psuedocode
 
Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014Don't Fear the Regex - CapitalCamp/GovDays 2014
Don't Fear the Regex - CapitalCamp/GovDays 2014
 
10 Jo P Oct 07
10 Jo P Oct 0710 Jo P Oct 07
10 Jo P Oct 07
 
Algorithm vs
Algorithm vsAlgorithm vs
Algorithm vs
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
Control structures pyhton
Control structures  pyhtonControl structures  pyhton
Control structures pyhton
 
Math In Business boa
Math In Business boaMath In Business boa
Math In Business boa
 
perl 6 hands-on tutorial
perl 6 hands-on tutorialperl 6 hands-on tutorial
perl 6 hands-on tutorial
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
"the Bund" language. A PEG grammar.
"the Bund" language. A PEG grammar."the Bund" language. A PEG grammar.
"the Bund" language. A PEG grammar.
 
Wade not in unknown waters. Part two.
Wade not in unknown waters. Part two.Wade not in unknown waters. Part two.
Wade not in unknown waters. Part two.
 
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loopsMastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
 
Stringing Things Along
Stringing Things AlongStringing Things Along
Stringing Things Along
 
Inheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionInheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth Version
 
Encryption is a process of converting a message, image, or any other .pdf
 Encryption is a process of converting a message, image, or any other .pdf Encryption is a process of converting a message, image, or any other .pdf
Encryption is a process of converting a message, image, or any other .pdf
 
03 Jo P Mar 07
03 Jo P Mar 0703 Jo P Mar 07
03 Jo P Mar 07
 
Analysis of Godot Engine's Source Code
Analysis of Godot Engine's Source CodeAnalysis of Godot Engine's Source Code
Analysis of Godot Engine's Source Code
 
14 Jo P Feb 08
14 Jo P Feb 0814 Jo P Feb 08
14 Jo P Feb 08
 
Theperlreview
TheperlreviewTheperlreview
Theperlreview
 

Recently uploaded

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

Pseudocode.docx angel

  • 1. Pseudocode From Wikipedia, the free encyclopedia Jump to: navigation, search In computer science and numerical computation, pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading. Pseudocode typically omits details that are not essential for human understanding of the algorithm, such as variable declarations, system-specific code and some subroutines. The programming language is augmented with natural language description details, where convenient, or with compact mathematical notation. The purpose of using pseudocode is that it is easier for people to understand than conventional programming language code, and that it is an efficient and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications that are documenting various algorithms, and also in planning of computer program development, for sketching out the structure of the program before the actual coding takes place. No standard for pseudocode syntax exists, as a program in pseudocode is not an executable program. Pseudocode resembles, but should not be confused with skeleton programs, including dummy code, which can be compiled without errors. Flowcharts and UML charts can be thought of as a graphical alternative to pseudocode, but are more spacious on paper. Contents 1 Application 2 Syntax 3 Mathematical style pseudocode 4 Machine compilation of pseudo-code style languages o 4.1 Natural language grammar in programming languages o 4.2 Mathematical programming languages  4.2.1 Alternative forms of pseudocode 5 See also 6 External links Application Textbooks and scientific publications related to computer science and numerical computation often use pseudocode in description of algorithms, so that all programmers can understand them, even if they do not all know the same programming languages. In textbooks, there is usually an accompanying introduction explaining the particular conventions in use. The level of detail of the pseudo-code may in some cases approach that of formalized general-purpose languages.
  • 2. A programmer who needs to implement a specific algorithm, especially an unfamiliar one, will often start with a pseudocode description, and then "translate" that description into the target programming language and modify it to interact correctly with the rest of the program. Programmers may also start a project by sketching out the code in pseudocode on paper before writing it in its actual language, as a top-down structuring approach. Syntax As the name suggests, pseudocode generally does not actually obey the syntax rules of any particular language; there is no systematic standard form, although any particular writer will generally borrow style and syntax; for example, control structures from some conventional programming language. Popular syntax sources include Pascal, BASIC, C, C++, Java, Lisp, and ALGOL. Variable declarations are typically omitted. Function calls and blocks of code, such as code contained within a loop, are often replaced by a one-line natural language sentence. Depending on the writer, pseudocode may therefore vary widely in style, from a near-exact imitation of a real programming language at one extreme, to a description approaching formatted prose at the other. This is an example of pseudocode (for the mathematical game bizz buzz): Fortran style pseudo code Pascal style pseudo code C style pseudo code: void function bizzbuzz program bizzbuzz procedure bizzbuzz for (i = 1; i<=100; i++) do i = 1 to 100 for i := 1 to 100 do { set print_number to set print_number to set print_number to true true; true; if i is divisible by if i is divisible by if i is divisible by 3 3 then 3 print "Bizz" print "Bizz"; print "Bizz"; set print_number set print_number set print_number to false to false; to false; if i is divisible by if i is divisible by if i is divisible by 5 5 then 5 print "Buzz" print "Buzz"; print "Buzz"; set print_number set print_number set print_number to false to false; to false; if print_number, if print_number, if print_number, print i print i; print i; print a newline print a newline; print a newline; end do end } See also category: Articles with example pseudocode Mathematical style pseudocode In numerical computation, pseudocode often consists of mathematical notation, typically from set and matrix theory, mixed with the control structures of a conventional programming
  • 3. language, and perhaps also natural language descriptions. This is a compact and often informal notation that can be understood by a wide range of mathematically trained people, and is frequently used as a way to describe mathematical algorithms. For example, the sum operator (capital-sigma notation) or the product operator (capital-pi notation) may represent a for loop and perhaps a selection structure in one expression: Return Normally non-ASCII typesetting is used for the mathematical equations, for example by means of TeX or MathML markup, or proprietary formula editors. These are examples of articles that contain mathematical style pseudo code: Algorithm Karmarkar's algorithm Conjugate gradient method Particle swarm optimization Ford-Fulkerson algorithm Stone method Gauss–Seidel method Successive over-relaxation Generalized minimal Symbolic Cholesky decomposition residual method Tridiagonal matrix algorithm Jacobi eigenvalue algorithm Jacobi method Mathematical style pseudocode is sometimes referred to as pidgin code, for example pidgin ALGOL (the origin of the concept), pidgin Fortran, pidgin BASIC, pidgin Pascal, pidgin C, and pidgin Lisp. Machine compilation of pseudo-code style languages Natural language grammar in programming languages Various attempts to bring elements of natural language grammar into computer programming have produced programming languages such as HyperTalk, Lingo, AppleScript, SQL, Inform and to some extent Python. In these languages, parentheses and other special characters are replaced by prepositions, resulting in quite talkative code. These languages are typically dynamically typed, meaning that variable declarations and other boilerplate code can be omitted. Such languages may make it easier for a person without knowledge about the language to understand the code and perhaps also to learn the language. However, the similarity to natural language is usually more cosmetic than genuine. The syntax rules may be just as strict and formal as in conventional programming, and do not necessarily make development of the programs easier. Mathematical programming languages
  • 4. An alternative to using mathematical pseudocode (involving set theory notation or matrix operations) for documentation of algorithms is to use a formal mathematical programming language that is a mix of non-ASCII mathematical notation and program control structures. Then the code can be parsed and interpreted by a machine. Several formal specification languages include set theory notation using special characters. Examples are: Z notation Vienna Development Method Specification Language (VDM-SL). Some array programming languages include vectorized expressions and matrix operations as non-ASCII formulas, mixed with conventional control structures. Examples are: A programming language (APL), and its dialects APLX and A+. Pseudocode Examples An algorithm is a procedure for solving a problem in terms of the actions to be executed and the order in which those actions are to be executed. An algorithm is merely the sequence of steps taken to solve a problem. The steps are normally "sequence," "selection, " "iteration," and a case-type statement. In C, "sequence statements" are imperatives. The "selection" is the "if then else" statement, and the iteration is satisfied by a number of statements, such as the "while," " do," and the "for," while the case-type statement is satisfied by the "switch" statement. Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool. The rules of Pseudocode are reasonably straightforward. All statements showing "dependency" are to be indented. These include while, do, for, if, switch. Examples below will illustrate this notion. What is pseudocode? Pseudocode consists of short, English phrases used to explain specific tasks within a program's algorithm. Pseudocode should not include keywords in any specific computer languages. It should be written as a list of consecutive phrases. You should not use flowcharting symbols but you can draw arrows to show looping processes. Indentation can be used to show the logic in pseudocode as well. For example, a first-year, 9th grade Visual Basic programmer should be able to read and understand the pseudocode written by a 12th grade AP Data Structures student. In fact, the VB programmer could take the other student's pseudocode and generate a VB program based on that pseudocode. Why is pseudocode necessary? The programming process is a complicated one. You must first understand the program specifications, of course, Then you need to organize your thoughts and create the program. This is a difficult task when the program is not trivial (i.e. easy). You must break the main tasks that must be accomplished into smaller ones in order to be able to eventually write fully developed code. Writing pseudocode WILL save you time later during the construction & testing phase of a program's development.
  • 5. How do I write pseudocode? First you may want to make a list of the main tasks that must be accomplished on a piece of scratch paper. Then, focus on each of those tasks. Generally, you should try to break each main task down into very small tasks that can each be explained with a short phrase. There may eventually be a one-to-one correlation between the lines of pseudocode and the lines of the code that you write after you have finished pseudocoding. It is not necessary in pseudocode to mention the need to declare variables. It is wise however to show the initialization of variables. You can use variable names in pseudocode but it is not necessary to be that specific. The word "Display" is used in some of the examples. This is usually general enough but if the task of printing to a printer, for example, is algorithmically different from printing to the screen, you may make mention of this in the pseudocode. You may show functions and procedures within pseudocode but this is not always necessary either. Overall, remember that the purpose of pseudocode is to help the programmer efficiently write code. Therefore, you must honestly attempt to add enough detail and analysis to the pseudocode. In the professional programming world, workers who write pseudocode are often not the same people that write the actual code for a program. In fact, sometimes the person who writes the pseudocode does not know beforehand what programming language will be used to eventually write the program. Example: Original Program Specification: Write a program that obtains two integer numbers from the user. It will print out the sum of those numbers. Pseudocode: Prompt the user to enter the first integer Prompt the user to enter a second integer Compute the sum of the two user inputs Display an output prompt that explains the answer as the sum Display the result Use this template when typing your pseudocode into MS Word: