PROBLEM SOLVING: ALGORITHM AND FLOWCHART

Problem Solving

A problem can be regarded as a difference between the actual situation and the desired situation. It identifies the gap between the current state and desired state of a process or product. Problems can be of any type viz. Mathematical and scientific problems, traffic problems, COVID-19 control, Admission process in a college, Data processing, weather forecasting, disaster management, hunger, poverty, scarcity of water, unemployment, etc. A problem statement is a concise description of an issue to be addressed or a condition to be improved upon.


Computers can't solve all the problems mentioned above. Problems that can be solved through a computer may range in size and complexity. Since computers do not possess any common sense and cannot make any unplanned decisions, the problem, whether it is simple or complex, has to be broken into a well-defined set of solution steps for the computer to implement. Thus Problem solving is the process of solving a problem in a computer system by following a sequence of steps.


Let us consider a case, where we have to find the sum of 3 numbers.


Our simple mathematical solution will be the following steps:


1. Take the first number


2. Take the second number


3. Take the third number


4. Add all the numbers


5. This computes the required result


In computer programming, we give these instructions (steps) to a computer using any programming language that computer understands and this ultimately solves the given problem.


Algorithms

An Algorithm is a procedure or formula for solving a problem, based on conducting a sequence of specified actions. It is a tool that provides a well-defined & efficient computational procedure to transform your input into output. An algorithm is defined as a step by step procedure of solving a given problem. Algorithm solves a given problem in three steps:


1. Input


2. Process


3. Output


Any of these steps can be a combination of two or more statements.


 Let us take some examples of algorithms:


Example 1

Algorithm to find the area of a circle


1. Start


2. Input radius


3. Area-3.14 *r


4. Print area


 5. Stop 


Example 2

Algorithm to find the perimeter of a rectangle


1. Start


2. Input length L


3. Input breadth B


4. Perimeter-2 (L+B)


5. Print Perimeter


6. Stop


Characteristics of an algorithm

1. Clear and Unambiguous: The algorithm should be clear and unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning.


2. Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs. 3. Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well.


4. Finiteness: The algorithm must be finite, i.e. it should terminate after a finite time.


5. Feasible: The algorithm must be simple, generic, and practical, such that it can be executed with the available resources. It must not contain some future technology or anything.


6. Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be the same, as expected.


Properties of an Algorithm

1. It should terminate after a finite time.


2. It should produce at least one output.


3. It should take zero or more input.


4. It should be deterministic means giving the same output for the same input case.


5. Every step in the algorithm must be effective i.e. every step should do some work.


 Flowchart

Flowchart is a pictorial representation of the separate steps of a process in sequential order. It is a generic tool that can be adapted for a wide variety of purposes, and can be used to describe various processes, such as a computer program, manufacturing process, an administrative or service process, or a project plan.


Symbols used in flowcharts:


(1)                                            Start/End  

  • The terminator symbol marks the starting or ending point of the system. It usually contains the word "Start" or "End." 



(2)                                   Arrow/Flow Line   

  • An arrow from one process step to the next is often called a "Flow Line", or simply an "Arrow". As the names indicate, they show the direction of process flow.



(3)                        Input/Output Symbol  

  • It is used to represent the inputs given by the user to the process and the outputs given by the process to the user.



(4)                              Process

  • It represents the actions, logics and calculations taking place in a process



(5)                               Diamond or Decision Symbol

  • It represents the condition or the decision- making step in the flowchart. The result of the decision is a Boolean value, which is either true or false. Each of these values takes the flow of the program to a certain point, which is shown with the help of arrows.



(6)                                         Connector

  • It is represented by a circle in a flowchart. It represents the continuation of the flow of steps when a flowchart continues to the next page

Example of Flow Chart

Example 1: Draw a flowchart to print the sum of two numbers




Example 2 : Draw a flowchart to print area of square.



   

Example 3: Draw a flowchart to find greater of two number

     

      


Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.