PROBLEM SOLVING TECHNIQUE


Before applying any method to solve a problem, it is necessary to understand a problem well and define it in clear and in ambiguous manner.

Computer needs clear and definite instructions to work on. The problem definitions include input, output and processing.

Once we define the problem clearly, we should apply appropriate method for problem solving. There are mainly three methods/ tools of problem solving.

§  Algorithm

§  Flowchart

§  Pseudocode

Algorithm:

Algorithm can be defined as the sequence of finite number of steps arrange in a logical order, to solve a problem.

An Algorithm consists of a set of initial conditions, produce the corresponding output and terminate in a fixed amount of time.

An algorithm has five important features.

§  An algorithm terminates after a fixed number of steps i.e. finiteness should be there.

§  Each step of algorithm should be defined precisely, it should have only meaning.

§  Effectiveness should be there i.e., all the operations used in the algorithm are basic and can be performed exactly in a ‘fixed duration of time’.

§  An algorithm should have precise input.

§  An algorithm has one or more outputs.

Before moving to the further details of drawing algorithm/flowchart, we will discuss about some important terms.

Constant and Variables: Constants are the quantities which were fixed. There are two types of constant:

§  Numeric Constants are the numbers which are used for mathematical calculations.

§  Character Constants are used to represent alphabets.

Variables are the memory locations whose value keeps changing during the execution of the program. Here variables are used to store the constants. Variables are also two types:

Operators: Operators allow the computer to take action and output the result. A symbol or a letter represents an operator. There are different types of operators, like Arithmetic Operators, Relational Operators and Logical Operators.

§  Arithmetic Operators: Arithmetic Operators consists plus(+), Minus(-), Division(/), Asterisk Multiplication(*), Bracket() etc.

§  Relational Operators: Relational Operators consists equal to(=), greater than(>), less than(<), not equal to(><>) etc.

§  Logical Operators: Basic purpose of logical operators is to connect two or more conditions and return a true or false value. These are three logical operators: NOT, OR and AND

o    AND Operator: AND operator will return true only when all the actions are true. Result can be shown using Truth Table:

o    OR Operator: Combined condition with the OR operator will return True when all the actions are True or one of them True and result will be False only when all conditions are False. Truth Table of OR operator:

o    NOT Operator: It produces the opposite result. If value of variable is false it will return true, otherwise false and it works only on one variable.

Example of an Algorithm:

An Algorithm to calculate Area of Circle.

§  Step 1: Input radius of circle.

§  Step 2: Apply formula to calculate the Area of circle.

§  Step 3: Print the result.

Flow Chart:

For systematic and careful analysis of the entire problem one should always go through the following steps:

§  Design an Algorithm.

§  Represent this algorithm through flowchart for better understanding the algorithm.

§  Write instructions in a programming language.

§  Run/Execute the program on the computer for the given set of input and get the output.

Flowchart can be defined as a graphical representation of an algorithm. It is constructed by using symbols, each symbol representing unique activity.

All symbols are connected among themselves to indicate the flow of information and processing. There are different types of symbols used in making of flowchart.

§  Terminal Box: It generally contains such words as BEGIN, START, END and STOP which indicates the START and the STOP of the flowchart.

§  Input – Output The parallelogram is used to indicate the getting of the data i.e. input and presenting the processed information i.e. output.

§  Process Box: The rectangle represents the processing operations. A process changes or moves data. e.g. Let C = A + B. It also assigns value be variable.

§  Decision Box: The diamond represents a decision that determines which of the alternative paths is to be followed, whether true or false.

§  Connectors: Sometimes flowchart gets lengthy and need to be split into two or more pages, and then connectors are used to indicate the end of the flowchart on one page and to the beginning of the flowchart on the next page.

§  Flow lines: It represents the flow of control. Generally flow direction is from top to down.

§  Annotation: It is used for the addition of descriptive comments or explanatory notes for clarification of some statements.

§  Pre-defined Process: The double sided rectangle is used to represent the modules or subroutines which are specified elsewhere.

Example of Flow Chart:

A Flowchart to accept three numbers and find their sum and average.

Advertisements

Give A message for us

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s