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

1.Steps in Problem Solving

The document outlines the fundamental concepts of computer programming, including problem definition, algorithm development, and the steps involved in problem-solving. It emphasizes the importance of efficient programming techniques and strategies such as divide and conquer, as well as the significance of proper coding, debugging, testing, and documentation. Additionally, it highlights the role of programmers in improving technology and solving real-world problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

1.Steps in Problem Solving

The document outlines the fundamental concepts of computer programming, including problem definition, algorithm development, and the steps involved in problem-solving. It emphasizes the importance of efficient programming techniques and strategies such as divide and conquer, as well as the significance of proper coding, debugging, testing, and documentation. Additionally, it highlights the role of programmers in improving technology and solving real-world problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 35

PROGRAMMING

PROGRAMMING
TECHNIQUES
TECHNIQUES
Unit - 1
Topics included
• Steps Involved in Computer
Programming
• Problem Definition
• Outlining The Solution
• Flow Chart
• Developing Algorithms
• Efficiency of Algorithms
• Analysis of Algorithms.
Introduction about
Problems
Computers everywhere

Ovens, washing machines and toys


Banks & Hospitals
Transport Reservations, Signaling
Aircraft and industrial plant controllers
Missiles and satellites,
and many more
Why so prevalent
• They solve a variety of problems
• Efficient maintenance of large no. of data
• Precise control of movements
• Automation of many boring manual processes
In all
• They improve the quality of life
Your Job

• Many improvements are made and


many more to come
• You, tomorrow's quality scientists and
Engineers, are responsible for this
• You need to develop expertise in using
computers,
• Ability to solve more problems using
computers
TOPICS TO BE DISCUSSED:
• What is a problem?-Types of problems
• Problem Solving in everyday life.
• What is Problem solving.
• Strategies
• Program
• Algorithm
• Steps involved in problem solving
What is a PROBLEM

• A state of difficulty that needs to be resolved

• PROBLEMS EXIST WHERE GOALS NEED TO BE ATTAINED

AND THERE IS UNCERTAINTY ABOUT SOLUTION


Problem Faced in Everyday in Life

• People make decisions everyday


• Examples:
 Should I wear casual or formal today?
 Should I watch TV or go out to cinema?
 what career?
 what course?
 What shoes?
 Everything needs a DECISION AS A SOLUTION TO THE
PROBLEM
What happens when bad decisions are made?

• WASTAGE OF TIME AND RESOURCES


Problem Solving
Problem solving
The act of finding a solution to a
perplexing, distressing, vexing, or
unsettled question

11
Strategies
Ask questions!
– What do I know about the problem?
– What is the information that I have to
process in order the find the solution?
– What does the solution look like?
– What sort of special cases exist?
– How will I recognize that I have found
the solution?

12
Strategies
Ask questions! Never reinvent the
wheel!
Similar problems come up again and
again in different guises
A good programmer recognizes a task or
subtask that has been solved before and
plugs in the solution

13
Strategies
Divide and Conquer!
Break up a large problem into smaller
units and solve each smaller problem
– Applies the concept of abstraction
– The divide-and-conquer approach can be
applied over and over again until each
subtask is manageable

14
Program
A set of explicit and
unambiguous instructions
expressed in a programming
language. That set of instructions
are called a program.
Algorithms
Algorithm
A set of unambiguous instructions for
solving a problem or subproblem in a
finite amount of time using a finite
amount of data

16
Six steps to ensure a Best decision in PROBLEM
SOLVING

• Identify the problem


• Understand the problem
• Identify alternative ways to solve the problem
• List instructions that enable you to solve the
problem using selected solution
• Select the best way to solve the problem from the
list of alternative solutions
• Evaluate the solution
Steps
Steps Involved
Involved in
in
Computer
Computer Problem
Problem
Solving
Solving
Computer Problem-
Solving
Analysis and Specification Phase
Analyze
Specification
Algorithm Development Phase
Develop algorithm
Test algorithm
Implementation Phase
Code algorithm
Test algorithm
Maintenance Phase
Use
Maintain

19
Phase Interactions

20
ALL THIS SUMMED UP
INTO 8 STEPS
• Problem definition Analysis and Specification
Phase

•Outline the solution

•Develop the algorithms Algorithm Development


Phase

•Coding Implementation Phase

•Debugging

•Testing

•Documentation Maintenance Phase

•Maintenance
Problem definition
•It involves developing the specifications of the problem.

•Discuss What is to be done rather than How it is to be done

•From the problem statement, we have to extract a set of


Precisely defined task.
•Specs include:
– Input data
• Type, accuracy, units, range, format, location, sequence
– Special symbols to signal end of data
– Output data (results)
• type, accuracy, units, range, format, location,
“headings”
– How is output related to input
– Any special constraint
•Example: “find the phone no. of a person” & “Development of
algorithm for finding square root
OUTLINE THE SOLUTION
• Write down the various steps and
explorations made. This is used to
systematize our investigations and avoid
duplication of efforts
• Another step to develop our problem
solving skill is once we have solved a
problem, to concisely reflect back on the
way to discover the solution
• The most crucial thing is to practice
• A solution is usually composed of many
interrelated tasks.
• Specify the responsibilities of each task
and how they correlate with each other.
Algorithm
Two methodologies used to develop
computer solutions to a problem
– Top-down design focuses on the
tasks to be done
– Object-oriented design focuses on
the data involved in the solution

24
Top-Down Design
Top-Down Design
Problem-solving technique in which the problem is
divided
into subproblems; the process is applied to each
subproblem
Modules
Self-contained collection of steps, that solve a
problem
or subproblem
Abstract Step
An algorithmic step containing unspecified details
Concrete Step
An algorithmic step in which all details are specified
25
Top-Down Design

Figure 6.5
An example
of top-down
design

Process continues for as many levels as it takes to make


every step concrete. Name of (sub)problem at one level
becomes a module at next lower level

26
A General Example

Planning a large party

Figure 6.6 Subdividing the party


planning
27
CODING
• Algorithm translated into a code using high
level language.
• The choice depends on the type of the
problem
• To get the exact result of the problem,
proper coding should be written
• The codes written should be efficient and
concise.
• It should be small enough.
DEBUGGING
After the coding part ends, we execute the
program to
•Discover,
•locate and
•correct the errors that causes undesired result.
The three types of errors are
Syntax error - grammatical rule violations.
Runtime error - causes errors during
execution.
Logical error - faulty logic.
Testing the
Algorithm
Important distinction

Mathematics
We tests the answer
Programs
We test the process

30
TESTING
• It should be done to report that whether
the problem has met its desired
requirements or not.

• The process of proving that the program


produces correct and meaningful results
for all possible data.

• It should use the cases that works with all


possible pars if the program.
Contd…
There are four test cases,
1.Valid case
Represents data that are logically
meaningful and which provides
correct results.
2.Boundary case
Represents data that has extremes for
valid range or the point at which a decision is
made.
3. Special case
Represents data for which normal
processing cannot be done.
4.Invalid case
Represents that are meaningless and
violate the statements of the problem.
DOCUMENTATION
• It is a Continuous process.
• Two kinds of documentation
* User level documentation
One needs in order to use the
program.
* Technical documentation
It is addressed to the
programmer who may modify the
program later.
Maintenance
• After the documentation gets
over, the system should be
properly maintained and updated
periodically.
End
End

You might also like