Thursday, November 5, 2020

Algorithm - Psuedo code - Flow chart - Defining algorithm

 A process or set of rules to be followed in calculations or other problem-solving operations by a computer.

An algorithm can be defined as a finite set of steps, which has to be followed while carrying out a particular problem.

An algorithm is a distinct computational procedure that takes input as a set of values and results in the output as a set of values by solving the problem.

Characteristics f Algorithms:


  • Input: It should externally supply zero or more quantities.

  • Output: It results in at least one quantity.

  • Definiteness: Each instruction should be clear and ambiguous.

  • Finiteness: An algorithm should terminate after executing a finite number of steps.

  • Effectiveness: Every instruction should be fundamental to be carried out, in principle, by a person using only pen and paper.

  • Feasible: It must be feasible enough to produce each instruction.

  • Flexibility: It must be flexible enough to carry out desired changes with no efforts.

  • Efficient: The term efficiency is measured in terms of time and space required by an algorithm to implement. Thus, an algorithm must ensure that it takes little time and less memory space meeting the acceptable limit of development time.

  • Independent: An algorithm must be language independent, which means that it should mainly focus on the input and the procedure required deriving the output instead of depending upon the language.

Advantages of an Algorithm


  • Effective communication: Since it is written in a natural language like English, it becomes easy to understand the step-by-step delineation of a solution to any particular problem.

  • Easy Debugging: A well-designed algorithm facilitates easy debugging to detect the logical errors that occurred inside the program.

  • Easy and Efficient Coding: An algorithm is nothing but a blueprint of a program that helps develop a program.

  • Independent of Programming Language: Since it is a language-independent, it can be easily coded by incorporating any high-level language.

Pseudo code :

It is a term which is often used in programming and algorithm based fields. It is a methodology that allows the programmer to represent the implementation of an algorithm.

Algorithms are represented with the help of pseudo codes as they can be interpreted by programmers no matter what their programming background or knowledge is.

It is simply an implementation of an algorithm in the form of annotations and informative text written in plain English. It has no syntax like any of the programming language and thus can’t be compiled or interpreted by the computer.

Advantages of Pseudocode


  • Improves the readability. It’s one of the best approaches to start implementation of an
    algorithm.
  • Acts as a bridge between the program and the algorithm or flowchart. Also works as a rough
    documentation, so the program of one developer can be understood easily when a pseudo code is written out.
  • The main goal of a pseudo code is to explain what exactly each line of a program should do,
    hence making the code construction phase easier for the programmer.

Example:

If student's grade is greater than or equal to 60

Print "passed"

else

Print "failed"

Flow Chart :

Flowchart is a schematic representation of an algorithm or a stepwise process, showing the steps as boxes of various kinds, and their order by connecting these with arrows. Flowcharts are used in designing or documenting a process or program.

 A flow chart, or flow diagram, is a graphical representation of a process or system that details the sequencing of steps required to create output.

 A flowchart is a picture of the separate steps of a process in sequential order.

The benefits of flowcharts are as follows:

1.      Flowcharts are better way of communicating the logic of a system to all concerned.

2.     With the help of flowchart, problem can be analysed in more effective way.

3.      Program flowcharts serve as a good program documentation, which is needed for various purposes.

4.      The flowcharts act as a guide or blueprint during the systems analysis and program development phase.

5.      The lowchart helps in debugging process.

6.      The maintenance of operating program becomes easy with the help of flowchart. It helps the programmer to put efforts more efficiently on that part

 LIMITATIONS OF USING FLOWCHARTS

 1.     Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy.

 2.     If alterations are required the flowchart may require re-drawing completely.

 3.   As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem.

Flowcharts are usually drawn using some standard symbols; however, some special symbols can also be developed when required.

Some standard symbols, which are frequently used are:


Strategy for developing an Algorithm:

The development of an algorithm (a plan) is a key step in solving a problem. Once we have an algorithm, we can translate it into a computer program in some programming language. Our algorithm development process consists of five major steps.

Step 1: Obtain a description of the problem.

Step 2: Analyze the problem.

Step 3: Develop a high-level algorithm.

Step 4: Refine the algorithm by adding more detail.

Step 5: Review the algorithm.

0 comments:

Post a Comment

Data Structures with C++



NET/SET/CS PG



Operating Systems



Computer Networks



JAVA



Design and Analysis of Algorithms



Programming in C++

Top