Definition

  • Pseudo-code is a compact and informal high-level description of a computer programming algorithm that uses the structural conventions of some programming language.
  • Pseudocode is a kind of structured English for describing algorithms in an easily readable and modular form. This helps in describing how the system will solve the given problem.

Characteristics

  • Pseudocode allows the designer to focus on the logic of the algorithm without being distracted by the details of the language syntax in which the code is going to be written.
  • It allows the designer to focus on the logic of the algorithm without being distracted by details of the language syntax in which the code is going to be written.
  • The pseudocode needs to be complete.
  • “Pseudocode” does not refer to a precise form of expression. It refers to the simple use of Standard English.
  • Pseudocode must use a restricted subset of English in such a way that it resembles a good high-level programming language. 
  • It describes the entire logic of the algorithm so that implementation becomes a routine mechanical task of translating line by line into the source code of the target language. Thus, it must include the flow of control.
  • Pseudocode describes the entire logic of the algorithm so that implementation becomes a routine mechanical task of translating line by line into the source code of the target language. Thus, it must include the flow of control.
  • Pseudocode helps in describing how the system will solve the given problem.
  • Pseudocode does not refer to a precise form of expression. It refers to the simple use of Standard English.
  • Pseudocode must use a restricted subset of English in such a way that it resembles a good high-level programming language.
  • Pseudo-code typically omits details that are not essential for understanding the algorithm, such as functions (or subroutines), variable declaration, semicolons, special words, and so on.
  • Pseudo-code is independent of any programming language.
  • Pseudo-code cannot be compiled nor executed, and not following any syntax rules.
  • One can write a pseudo-code for any given problem without even knowing what programming language one will use for the final implementation.

    Objectives

    • The purpose of using pseudo-code is that it is easier to read than conventional programming languages which enables (or helps) the programmers to concentrate on the algorithms without worrying about all the syntactic details of a particular programming language.

    Rules/Conventions to Create a Pseudocode:

    The following conventions must be used during the creation of pseudo-code. These are –

    • Give a valid name for the pseudo-code procedure, initially.
    • Use the line numbers(not step-wise as in the algorithm) for each line of code.
    • Use proper Indentation for every statement in a block structure to represent well.
    • For flow control statements, use if-else and always close with an end-if. Both if, else, and end-if should be aligned vertically in the same line.
     if (expression)
    statements
    else
    statements
    end if
    We can separate two or more conditions with the ‘and’ word.
    • Use = or ← operator symbol for assignment operation, if any.
    • In Pseduocode, array elements can be represented by specifying the array name followed by the index in square brackets. For example, A[i] indicates the ith element of the array A.
    • In the case of looping or iteration statements, use for or while statements and always end a for loop with end-for and a while with end-while.
    • Wherever required, we can also put comments symbol( /* ….  */) in between.
    • The pseudocode needs to be complete.

    For Example

    • The pseudo-code for finding the maximum of three numbers is –
    Input parameters(a,b,c)
    Output parameters(x)
    FindMax(a,b,c,x)
    {
    x=a
    if(b>x)
    x=b
    if(c>x)
    x=c
    }
    • The pseudo-code for finding the message of overtime or regular time on working hours –
    If HoursWorked > MaxWorkHour Then
    Print “Overtime”
    Else
    Print “Regular Time”
    End If

    Loading


    0 Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.