5 Examples of Pseudocode Algorithms and Their Writing Guide in Programming - Asia B Technology

5 Examples of Pseudocode Algorithms and Their Writing Guide in Programming

For the general public, programming language words such as pseudocode are terms that sound difficult to understand. But that doesn’t mean you’re not able to understand it, let’s learn more about pseudocode.

So after you read this article, you not only understand but also be able to directly practice pseudocode algorithms to better understand them thoroughly. What is pseudocode?

Learn the meaning and function of pseudocode for programming – EKRUT

Before you know pseudocode, you must first understand what a programming language is. Programming language is a language that will be read by the machine / software in creating an event. While pseudocode is actually not a programming language, but a form of writing a breakdown procedure using code that contains artificial languages according to programming languages.

Its function is to solve a problem in simple sentences that can be more easily read by humans, therefore pseudocode is widely used. Pseudocode itself comes from according to the term pseu i.e. imitation or imitation & code, which means code or symbol.

Different according to programming languages that must follow some exclusive rules in order to read the machine, pseudocode writing is more free and does not have its own standard budget or formula. If a programming language is created for the machine or computer to read, pseudocode is created for the human to read. In essence, pseudocode is a simpler way to write programming code.

The characteristics based on pseudocode are:Using simple English patternsDoes not have a specific standard rule on its writingPseudocode uses symbols or syntax based on an event, such as ←, <, >, <=, >=, & so on.Pseudocode notation can be used for programming languagesNot using diagrams but rather written in the order of an event or fight.Pseudocode contains the steps to complete a case (e.g. the solving procedure), but the shape of the problem is slightly out of sync according to the algorithm.Often used by users to write an algorithm of a fight.

Also read: 7 Tips to learn programming for those of you who are beginners

Pseudocode has several functions for programming, including: 1. Make it easier for users to understand how to solve a problem.

The primary function of pseudocode is to make it easier for people to read or resolve a conflict from a solving procedure or programming language. This can happen because pseudocode can be read easily by the user, namely humans.

Without pseudocode, the conflict over the impact of programming language writing errors would be very difficult to detect. But this can be overcome because pseudocode can convert programming language code. So that when there is a case or error to the code received or is being formed, users can use pseudocode to detect the case. 2. Troubleshooting documentation tools

Not only does it help complete a fight, pseudocode can also be a documentation tool. That is to be a bridge between the user and the programming language. Pseudocode will document all the data processing processes.

Pseudocode plays a crucial role in helping users translate programming languages faster. The general public cannot analyze a mathematical algorithm creation project or something that involves programming languages using a personal computer without pseudocode.

So that pseudocode becomes a sense of documentation that helps people translate programming languages into simpler languages so that they can be understood by humans. Write down algorithm formulas that are easier to read

Pseudocode is also useful to write the formulas of the solving procedure more simply. So that the solving procedure written using pseudocode as easier to understand than algorithms written with programming languages. Finally, users will be quicker to receive an image of the level of complexity of a program to be formed, using writing the solving procedure in pseudocode form. More concise and simple

Pseudocode is easier to make because it does not depend on a particular system and also the algorithm is more concise and easy to read.

Read also: 12 Most poly-searched programming languages of 20203 Basic structure of pseudocode algorithms

Write down pseudocode breakdown procedures – EKRUT

To write a pseudocode algorithm, three basic structures are needed, namely: 1. Heading

The title used in the pseudocode is the title of the algorithm to be used or the title that the author wants to create. For example, if you want to create a program to determine the circumference of a square, then the title will be written like this:

Program a. Menentukan_Keliling_Persegi Programb. programming r Menghitung_luas_persegi_panjang2 program. Description

This section contains a declaration according to the news of the solving procedure to be made, namely the fact that the variable (var) or constant used to calculate a particular formula. Variables are containers of data to be used.

Description of ; then written

a. DescriptionVar side, circumference : integer;

b. Descriptionvar length, width, area : integer;3. Implementation

This section contains the process or steps that will be done the breakdown procedure or core according to the solving procedure itself. This means that the user must write down the number in each variable to be calculated and so on. An example of writing is like this,

Implementation (contains the core of the algorithm just now); then written

a. ImplementationRead(side);around the ← contents*4;Write (circumference);

b. ImplementationRead(length);Read(width);← area of length*width;Write (broad);

After knowing the structures of pseudocode, next you will write the structures above as a sequence so that it becomes a complete algorithm. Example:

Pseudocode algorithm to determine square circumferenceTitle: Menentukan_Keliling_Persegi ProgramDeclarationVar side,circumference: integer;ImplementationRead(side);Around the ← sides*4;Write(circumference);

Pseudocode algorithm to determine the area of a rectangleTitle: Menghitung_luas_persegi_panjang ProgramDeclarationvar length, width, area : integer;ImplementationRead(length);Read(width);← area of length*width;Write (broad);

Keep in mind, there are several things that you must pay attention to in writing pseudocode algorithms, for example:Using a controlled structureUse appropriate title namingMake the algorithm simple and conciseThe key is to keep spaces and indentations leftDo not create shapeless codeDon’t make code that’s too common.Set the order of tasks and write your code using authenticityStart using a code statement that sets goalsDo not include too many technical terms that are difficult for ordinary people to understandCheck home if all parts of the pseudocode are complete, limited, & clear to understand.5 examples of pseudocode algorithms

Write down pseudocode algorithms – EKRUT

In order for you to understand more about pseudocode, let’s look at the following models of pseudocode algorithms: 1. Search the area of the football field

Headingluas_lapangan_sepak_bola Program

Descriptionvar length, width, outside : integer;

Implementation← length 100;← width 64;← area of length*width;broad print;two. Determining a number is odd or even

Headingganjil_genap Program

Descriptionvar number : integer

ImplementationREAD saptaIF (sapta modulus 2 = 0) THENPRINT “even”ELSEPRINT “odd”ENDIF3. Counting down

Descriptionvar sapta : integer

ImplementationFOR (number ← five; nilangan > 0; sapta–)PRINT numberENDFOR4. Calculating the area of a triangle

Title: hitung_luas_segitiga Program

Descriptionvar broad, base, height : integer;

Implementation← base 25; height ← 30;← area 1/2*pedestal*high*write (broad)five. Calculating the area of a circle

Title: hitung_luas_lingkaran Program

Declarationvar phi, float; var r, outside, integer;

Implementationphi ← 22/7; read (r) ; (inputted by user)←phi*r*rwrite (broad);

Also read: 5 Programming Tips you need to know

Asi B Technology

Silahkan Subscribe untuk Mendapatkan Update Terbaru Sekitar Technology

We don’t spam! Read our privacy policy for more info.