0% found this document useful (0 votes)
9 views

Introduction To Problem Solving

The document discusses problem solving and algorithms. It defines key terms like problem, process, algorithm and flowchart. It describes the steps involved in problem solving like understanding the problem, devising a plan, carrying out the plan and looking back. It also discusses characteristics of a good algorithm like precision, uniqueness, finiteness and flow control. Different ways of representing algorithms like pseudocode and flowchart are explained.

Uploaded by

zacmarbuch
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Introduction To Problem Solving

The document discusses problem solving and algorithms. It defines key terms like problem, process, algorithm and flowchart. It describes the steps involved in problem solving like understanding the problem, devising a plan, carrying out the plan and looking back. It also discusses characteristics of a good algorithm like precision, uniqueness, finiteness and flow control. Different ways of representing algorithms like pseudocode and flowchart are explained.

Uploaded by

zacmarbuch
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

N G

V I
S OL
E M
BL
RO
P
OBJECTIVES
• Define the terms: ‘problem’,’ ‘process’, problem solving’, ‘algorithm’
• Describe simple processes in everyday life
• List the steps to solve a problem
• Explain the steps involved in problem solving process
• Devise algorithms to solve real life problems
• Define the term algorithm
• Explore characteristics of a good algorithm
• Compare algorithms and select the best option
• Describe the importance of an algorithm
• Use simple algorithm to solve everyday problems
• Define the term flowchart
• Identify flowchart symbols
• Draw simple flowcharts
WHAT IS A PROBLEM?

A problem can be defined as a difference


between the actual situation and the
desired situation.

The discrepancy between the way things


are and the way we want them to be.
PROBLEM SOLVING
Problem solving is the
process of identifying
a problem,
developing an
algorithm for the
identified problem
and finally
implementing the
algorithm to develop
a computer program.
STEPS TO PROBLEM SOLVE.
• Understanding the problem
• Identify aspects are known on the problem
• Mention the information based on the problem
• Connect the problem with another topics
• Devising a plan
• Make a mathematical form based on the problem
• Show mathematical concepts that would be used to solve problem
• Carrying out the plan
• Analyze the process of problem-solving based on a plan
• Looking back
• Check the accuracy of answer with the questions.

• https://www.wtamu.edu/academic/anns/mps/math/mathlab/int_algebra/int_alg_tut8_pro
bsol.htm
WHAT IS AN ALGORITHM?

A set of exact steps which when followed, solve the


problem or accomplish the required task.

A programmer writes a program to instruct the computer to do certain tasks as


desired. The computer then follows the steps written in the program code.
Therefore, the programmer first prepares a roadmap of the program to be
written, before writing the code. Without a roadmap, the programmer may
not be able to clearly visualize the instructions to be written and may end up
developing a program which may not work as expected.
ALGORITHM

In our day-to-day life we perform activities by following certain sequence of steps.


Examples of activities include getting ready for school, making breakfast, riding a
bicycle, wearing a tie, solving a puzzle and so on. To complete each activity, we
follow a sequence of steps.
Suppose following are the steps required for an activity ‘riding a bicycle’:
1) remove the bicycle from the stand,
2) sit on the seat of the bicycle,
3) start peddling,
4) use breaks whenever needed and
5) stop on reaching the destination.
CHARACTERISTICS OF A GOOD ALGORITHM

The
number of Steps must
steps must be Must
be finite unambiguous terminate

Must be Must
precise have Must lead
flow to an
control output
CHARACTERISTICS OF A GOOD
ALGORITHM
• Precision — the steps are precisely stated or defined.
• Uniqueness — results of each step are uniquely
defined and only depend on the input and the result
of the preceding steps.
• Finiteness — the algorithm always stops after a
finite number of steps.
• Input — the algorithm receives some input.
• Output — the algorithm produces some output.
WAYS TO REPRESENT ALGORITHM

Pseudocode - A pseudocode is an imitation computer program written using


mathematical notations and English-like statements to describe the logics to solve
a problem or carry out a procedure.

Flowchart - a diagram of the sequence of steps or actions of things involved in a


complex system or activity. A graphical representation of a pseudocode. A
flowchart is a visual representation of an algorithm. A flowchart is a diagram
made up of boxes, diamonds and other shapes, connected by arrows.
PSEUDOCODE
Before writing codes in a high-level language, a
pseudocode of a program helps in representing the
basic functionality of the intended program. By
writing the code first in a human readable language,
the programmer safeguards against leaving out any
important step. Besides, for non-programmers, actual
programs are difficult to read and understand, but
pseudocode helps them to review the steps to confirm
that the proposed implementation is going to achieve
the desire output.
PSEUDOCODE
Keywords
• START
• STOP
• PRINT
• READ
Identifiers
• Variables – same as in MATH!
Operators – follows mathematical order of operations
• ()
• *
• /
• +
• -
• 
PSEUDOCODE
Sequence Classwork Activity.
I’ll do this one: Accept 2 numbers and find the sum.

Now you do these:


• Accept 2 numbers and print the product. (5marks)
• Accept 3 numbers and print the average. (5marks)
• Accept a number and print the square. (5marks)
PSEUDOCODE
Selection – Making a decision IF <condition> THEN
Decision making key words steps to be taken when the condition
• IF is true
• THEN ENDIF
• ELSE
• ENDIF
Decision Making Operators IF <condition> THEN
• >
steps to be taken when the condition
• < is true
• >= ELSE
• <= steps to be taken when the condition
• = is false
ENDIF
PSEUDOCODE
Selection Classwork Activity
Let me Do this one for you: Accept 2 numbers and find the larger.

• Accept the price of an item. IF it is greater than 500 give a discount of 10%.
• Print Accept if the age of a party-goer is greater than 18, otherwise print Decline.
• Accept a student grade and print “You got first Honors” if the grade is 90 or more.

• Homework on Moodle
FLOWCHART
FLOWCHART
Redo all the algorithms as Flowcharts.

You might also like