You are on page 1of 15

Programming and Problem Solving


Credit Points: 04

Examination pattern
– 30 marks : In sem
– 70 marks : End Sem
– 25 marks: Practical

Book:
– “Python programming using problem Solving
Approach” by Reema Thareja: Oxford University
Importance of Subject


Programming is basic need of an engineer
– Example: calculator basic need of accountant
– Importance of subject: In every stream it is needed

Qualities of an engineering graduate
– Quick learner
– Problem understanding
– Decision making
– Soft skill

Any Programing is a kind of problem solving
st
Syllabus 1 unit


Problem Solving, Programming and Python Programming
1. General Problem Solving concepts
2. Program planning Tool: algorithm, pseudo
code,flowchart
3. Python Introduction: features, variables, i/o, Expression


Importance of text book while studying subjects
– No matter format of questions changes
– Execrcise questions appear in exam as it is
Problems in day to day life

Some people are efficient while some are not in problem solving
– Require atitude,approach and understanding
– Example: two students may have different approach w.r.t. subject

Examples of day to day life problems
– Choosing a career option
– Buying a house, or car , how to Sell a plot or house
– Coping up in a new environment: college or hostel
– Joining a new company , How to tackle with boss
– Starting of a new business , Travelling by plane first time
– Communication problem, Bus facility not available
– Not understanding a subject, not able to concentrate on study
Problem Solving Steps


There are six Problem solving steps to be followed for
solving day to day life problems:
– identify the problem: i.e. Define clearly, what, whom

Example: a patient
– Understand problem: find root cause and define goals,barriers

Example: Not getting proper marks
– Find alternative solutions: After defining goals, choose methods
– Select the best by evaluating Alternative solutions
– Design solution
– Evalute final solution: otherwise repeat from first
Types of Problems


Algorithmic Problems
– solution can be expressed as sequence of steps
– Example: making a cup of tea
– Example: Mathematical Problem: largest of given list

Heuristic Problems
– Solution can not be expressed as set of steps
– Requires knowledge(experience) to solve it
– Example: Choosing career option, choosing business
– Example: Mathematical problem: choosing a group of three
students satisfying some constraint
Difficuilties in problem Solving


People not willing to accept challanges

Problems are not properly defined.

Problem is not understood well

All alternative solutions are not considered

Wrong evalution of alternative solutions
Problem Solving Aspects


These are important issues involved in solving
computational problems
– Preliminary investigation: find i/p and expected o/p. We must try
to extract a set of precisely defined task
– Getting started on the problem: Focus on what is to be done and
not on how it is to be done. Plan the solution instead of directly
starting to solve it
– Use specific examples: ie use test data
– Use similarities among the problems
– Work backword from the problem
– Apply problem solving strategies: Five predesigned Techniques
Problem Solving Strategies


Following are the problem solving strategies
used to solve computational problems
– Divide and Conquer
– Greedy Technique
– Dynamic Programming
– Backtracking
– Branch and Bound
Divide and Conquer


Divide and conquer: To solve a given problem we solve
similar problems twice or more times.

We divide the input into more part and each input is
treated as a seperate problem and solved
independantly of the others

Finally we combine all smaller solutions to get solution
to the original problem: example making a chair
– Example sort a list: we perform sort process twice: not works
– SEARCH: we do search multiple times, This technique will
work for searching problem
Greedy Technique


This applied when solution is to be comprised by
constructing a set of members:
– where the members are selected one by one, each
member satisfying some criteria
– Then the selection of each member is made on the basis
of a greedy rule, i.e select that member which looks most
promising in current situation;
– But that selection may prove costlier in future and we can
not rollback
– Ex: Finding Shortest Path, Selecting currency notes
Dynamic Programming


This is used for solving optimization problem

The basic idea is to find solutions for smaller
inputs and then from it build solution for given input

Ex: Filling up a bag with objects of various prizes
to maximize the amount
– where the total weight of the bag should not exceed its
given capacity the bag capacity
– DP is solve it for bags of smaller capacity and find
solution for bag of given capacity
Backtracking


Used in case where solution is to be found out by
generating all possible trials

The method follows a path and comes back on the
same path by one step if it gets blocked at any mode
while going forward.

After coming one step back it tries next untried option

Example: travelling Kopargaon to Ahmednagar
– Assuming the route is not known (as in computers)
– Password cracking
Branch and Bound


Is also a technique used for solving Optimization
problems:
– Where the solution is to be found by generating all
possible trials
– This technique uses some criteria to eliminate some
possibilities and hence the search space is reduced
– Example: forming a bunch of three flowers out of 100
different types flowres each one having different price; with
a constraint p1+p2+p3<100
– No need to generate a bunch if any two>=100
Top Down Design approach

This is a design approach used to solve comples problems

Complex problems need to be broken into small “independant”
subtasks

Solve the subtask seperatly

Example: Designing a shopping portal: the s/w design subtasks
– User log in
– Searching product by a user
– Giving orders
– Shopping cart of customer
– Payment
– Delivary of product to customer

You might also like