Class 9 Exam  >  Class 9 Notes  >  Cyber Olympiad for Class 9  >  Algorithms and Flowcharts

Algorithms and Flowcharts | Cyber Olympiad for Class 9 PDF Download

Algorithm

An algorithm is a sequence of steps designed to perform a particular task. A computer is not intelligent enough to do things by itself; it is only capable of carrying out your instructions. In order to carry out some task, a computer needs to be provided a program, which is an implementation of an algorithm. Developing a correct algorithm is an intellectual challenge while coding is straightforward. An algorithm is a representation of a solution to a problem.
The most widely used notations for developing algorithms are:

  • Flowchart: A  flowchart is a diagram containing lines that represent all possible paths through the program.
  • Pseudocode: Pseudocode is a form of ‘stylized’ (or structured) natural language.
  • Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is very similar to everyday English.
  • These are independent of the programming language to be used to implement the algorithm.

Steps in Problem Solving

  • First, produce a general algorithm (You can use pseudocode).
  • Refine the algorithm successively to get a step-by-step detailed algorithm that is very similar to a computer language.
    Example: Write an algorithm to determine the students’ final grade and indicate whether they pass or fail. The final grade is calculated as the average of four marks.

Its algorithm will have the following steps:

  • Input a set of 4 marks. 
  • Calculate their average by adding them and dividing by 4. 
  • If the average is below 40, then print FAIL else print PASS.

Pseudocode is as follows:
Algorithm student's final grade

Step 1. Scan four values which are M1, M2, M3, M4

Step 2. GRADE = (M1 + M2 + M3 + M4) / 4

Step 3. if (GRADE < 40)  

Print “FAIL”
else
Print “PASS”
Step 4: Exit


Flowchart

A flowchart is a graphical representation of the sequence of operations in a program. It is a tool developed to show the steps involved in a process. Program flowcharts show the sequence of instructions in a single program. It shows the logic of an algorithm. It emphasizes individual steps and their interconnections.
The chart helps us to solve any problem easily through pictures compared to words. Hence an algorithm can be represented diagrammatically in the form of a flowchart.
A flowchart is basically the plan to be followed when the program is written. It acts as a road map for a programmer and guides him in proceeding from the starting point to the final point while writing a computer program. For a beginner, it is strongly recommended that a flowchart is drawn first in order to reduce the number of errors and omissions in the program. Moreover, it is a good practice to have a flowchart along with a computer program as it is helpful in testing the program and also in incorporating any modifications.

Flowchart Symbols

A flowchart uses boxes of different shapes to denote different types of instructions. The actual instructions are written within these boxes through clear and concise statements. Different flow chart symbols have different meanings. The most common flow chart symbols are shown in the following table.

Common flowchart symbols

Algorithms and Flowcharts | Cyber Olympiad for Class 9

Flowcharting Rules

A set of flowcharting rules are as follows

  • First, formulate the mainline of logic, and then incorporate the details. 
  • Maintain a consistent level of detail for a given flowchart. 
  • All boxes in a flowchart are conceited by arrows. 
  • Words in the flowchart symbols should be common statements that are easy to understand. 
  • Be consistent in using names and variables in the flowchart. 
  • Go from left to right and top to bottom in constructing the flowchart. 
  • Keep the flowchart as simple as possible. The crossing of flow lines should be avoided as far as possible. 
  • If a new flowcharting page is needed, it is recommended that the flowchart be broken at an input or output point. Moreover, labeled connectors should be used to link the portions of the flowchart on different pages. 
  • Flow chart symbols have an entry point on the top of the symbol and nowhere else. It has exit points at the bottom.
  • All flowcharts should end with a terminal.

Advantages of Flowchart


  • Conveys Better Meaning: It becomes easier for a programmer to understand and explain the logic of the program to another programmer.
  • Analyses the Problem Effectively: A macro flowchart that shows the mainline of the logic of a software system becomes a system model which can be broken down into detailed parts for study and further analysis of the system.
  • Effective Joining of a Part of a System: A group of programmers is normally associated with the design of large software systems. Each programmer is responsible for designing only a part of the entire system. So initially, if each programmer draws a flowchart for his part of the design, the flowcharts of all the programmers can be placed together to visualize the overall system design.
  • Efficient Coding: Once a flowchart is ready, programmers find it very easy to write the program because the flowchart acts as a roadmap. It guides them in proceeding from the starting point to the final point ensuring that no steps are omitted in between. The ultimate result is an error-free program developed at a faster rate.
  • Systematic Debugging: A flowchart is very helpful in detecting, locating, and removing mistakes (bugs) from a program in a systematic manner.
  • Systematic Testing: Testing is the process of confirming whether a program will be able to successfully perform all tasks for which it has been designed under the specified constraints. To test a program, different sets of data are fed as input to that program which eventually helps in determining the program logic.

Limitations of Flowcharts

A flowchart has the following limitations:

  • Takes more time to draw: Flowcharts are very time-consuming and laborious to draw with proper symbols and spacing, especially for large complex programs.
  • Difficult to make changes: Owing to the symbol-string nature of flowcharting, any changes or modifications in the program logic will usually require a completely new flowchart to be re-drawn. Redrawing a flowchart is tedious and many companies either do not change them or produce the flowchart using a computer program.
  • Non-standardization: There are no standards determining the amount of detail that should be included in a flowchart.

Pseudocode

Pseudocode is one of the tools that can be used to write a basic plan which can be developed into a computer program. It can be called a template used to write detailed codes in a specific programming language. Pseudocode is a way in which an algorithm without the use of any specific programming language syntax is described. It is, as the name pseudo-code suggests, cannot be executed on a real computer, but it models and resembles real programming code, which in turn is helpful in formulating the actual algorithm. Pseudocode, by nature, exists in various forms, although most borrow syntax from other programming languages (like Lisp, C, or FORTRAN).
This technique resultsPseudocode is one of the tools that can be used to write a basic plan which can be developed into a computer program. It can be called a template used to write detailed codes in a specific programming language. Pseudocode is a way in which an algorithm without the use of any specific programming language syntax is described. It is, as the name pseudo-code suggests, cannot be executed on a real computer, but it models and resembles real programming code, which in turn is helpful in formulating the actual algorithm. Pseudocode, by nature, exists in various forms, although most borrow syntax from other programming languages (like Lisp, C, or FORTRAN).
This technique results in a series of numbered steps that are executed in sequence. Each step is written using a subset of a language you can understand (in my case, English). This subset is based on a common set of verbs found in procedural programming languages and the common mathematical operators (+, -, *, /, =).

The document Algorithms and Flowcharts | Cyber Olympiad for Class 9 is a part of the Class 9 Course Cyber Olympiad for Class 9.
All you need of Class 9 at this link: Class 9
7 videos|27 docs|69 tests

Top Courses for Class 9

7 videos|27 docs|69 tests
Download as PDF
Explore Courses for Class 9 exam

Top Courses for Class 9

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

mock tests for examination

,

Objective type Questions

,

shortcuts and tricks

,

Algorithms and Flowcharts | Cyber Olympiad for Class 9

,

study material

,

Summary

,

Extra Questions

,

Viva Questions

,

Algorithms and Flowcharts | Cyber Olympiad for Class 9

,

Semester Notes

,

Free

,

video lectures

,

Algorithms and Flowcharts | Cyber Olympiad for Class 9

,

Exam

,

past year papers

,

Sample Paper

,

Previous Year Questions with Solutions

,

practice quizzes

,

ppt

,

MCQs

,

pdf

,

Important questions

;