You are on page 1of 47

Problem Solving

   Problem .a discrepancy  current state-desired state Decisions.Choices  Two or more alternatives Decision Making  process of choice making .

.

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. .

directions for organization . lower level workers (usually alone)  Non programmed  Complex. upper level supervisors (usually in groups)  Strategic  high level. no prescriptions available. non programmed. routine. preestablished routines and procedures. creative.Types of Decisions  Programmed  Simple.

uncertain  knowledge of decision outcomes  probability of decision outcomes  information available  Uncertainty Reduction .Types of Decisions  Certain vs.

Everything needs a DECISION AS A SOLUTION TO THE PROBLEM . Should I study physics or mathematics? Should I watch TV or go out to cinema?..Problem Faced in Everyday in Life           People make decisions everyday Examples: Should I wear casual or formal today?.. what career? what course? What shoes? ...

What happens when bad decisions are made?   WASTAGE OF TIME AND RESOURCES COST .

Approaches to solve a problem: Algorithmic Heuristic Important definitions Solutions that can be solved with a series of known actions are called Algorithmic Solutions Employing a self-learning approach to the solution of a problems is known as Heuristic Solutions .

 cross-checking.  profit-loss statement. Solutions can be reached through a direct set of steps. Balance sheet. and a process of trial and error.  Balancing checkbook.000 names   Heuristic solutions Problem solution requiring reasoning based on knowledge and experience.  Alphabetizing 10.  How to buy the best stock or expand the company  Difficult to evaluate the solution  .Types of Problems  Algorithmic solutions Problems that can be solved with a series of actions.  Solutions cannot be reached through a direct set of steps. baking a cake.

Examples Algorithmic solution:  To make a cup of coffee  To find largest of three numbers Heuristic solutions:  how to buy the best stock?  How to play chess? .

000 names  This class deals with algorithmic solutions .Types of Problems  People are better at solving heuristic problems  Artificial intelligence is the field of computer science that deals with heuristic problems  Computers are better at solving complicated calculus problems or alphabetizing 10.

Problem solving with computers Computers use algorithmic solutions  Program – set of instructions that make up solution to a problem  Results – outcome of running the program  Testing – Are the outcomes what you expected and correct  Documentation – two types  manual documentation – instructions telling users how to use the program .

.validation.Problem solving with computers involves several steps Clearly define the problem.  Draw a flowchart of the algorithm.  Test the program (debugging) (see also verification.).  Analyze the problem and formulate a method to solve it (see also .).  Describe the solution in the form of an algorithm.  Interpretation of results. Compile and run the program (debugging).   Write the computer program.

Problem solving concepts for computers  Constants  Variables  Operators  Hierarchy of operations  Data types  Equations  Functions  Expressions .

alphabetical. that stays the same throughout the program's execution-numeric. Ex:PI=3. special symbols.  A constant is a value in a program.Constant:  A variable whose value is determined when a program description is written and doesn’t change from that value during program execution.142857 Rules: Constant cannot be changed after it is initially given a value .

Ex:city=“chennai” .  Variables are values that can change as much as needed during the execution of a program.Variable: a named location in memory for storing data.

Information O U T P U T I N P U T Data Unorganized facts P R O C E S S Information Processed meaningful report .Data vs.

.DATATYPE  A type is the “kind” of data that variable is allowed to hold .

Problem Solving Steps  Identify the problem  Understand the problem  Identify alternative ways to solve the problem  Select the best way to solve the problem from the list of alternative solutions  List instructions that enable you to solve the problem using selected solution  Evaluate the solution .

 Means-end analysis: requires the setting of sub-goals based on the process of getting from the initial state to the goal state when solving the problem.  Hill-climbing: attempting at every step to move closer to the goal situation. complex problem into smaller.Problem Solving Techniques  Divide and conquer: break down a large. solvable problems. .

Divide and conquer .

Hill Climbing .

Means-end analysis .

. select another possibility.Problem Solving Techniques  Trial-and-error: select a possible answer. apply it to the problem and. if it is not successful. Ends when a possibility yields a solution.  Brainstorming: a group technique designed to generate a large number of ideas for the solution of a problem.

Trial and Error method .

Brainstorming .

.

Communicating with computer What is a program?  A set of step-by-step instructions that directs the computer to perform tasks and produce results. What is a Programming Language?  A programming language is a set of rules that instructs a computer what operations to perform. .

 Syntax: Rules governing the computer oerating system. . the language and the application  BUG: It is an error  Debugging: The process of locating and correcting an error.

the processing and the output  Algorithm – show the sequence of instructions comprising the solution  Flowcharts – graphic representations of the algorithms .Organising Problems Certain organisational tools can help us to solve problems : Problem Analysis Charts – a beginning analysis of the problem  Structure/Interactivity Charts – shows the overall layout or structure of the solution  IPO Chart – shows the input.

How to Solve It Name Informal Description Analogy Can you find a problem analogous to your problem and solve that? Generalization Can you find a problem more general than your problem? Induction Can you solve your problem by deriving a generalization from some examples? Variation of the Problem Can you vary or change your problem to create a new problem (or set of problems) whose solution(s) will help you solve your original problem? Auxiliary Problem Can you find a sub-problem or side problem whose solution will help you solve your problem? Here is a problem related to yours and solved before Can you find a problem related to yours that has already been solved and use that to solve your problem? .George Pólya's 1945.

George Pólya's 1945. How to Solve It Name Informal Description Specialization Can you find a problem more specialized? Decomposing and Recombining Can you decompose the problem and "recombine its elements in some new manner"? Working backward Can you start with the goal and work backwards to something you already know? Draw a Figure Can you draw a picture of the problem? Auxiliary Elements Can you add some new element to your problem to get closer to a solution? .

.

Dennis Ritchie .

the inventor of the C programming language) .Ken Thompson (left) with Dennis Ritchie (right.

.

.

.

An algorithm is a procedure or formula for solving a problem. and automated reasoning. . data processing. It is a self-contained step-by-step set of operations to be performed. Algorithms exist that perform calculation.

workflow or process.FLOWCHART A flowchart is a type of diagram that represents an algorithm. and their order by connecting them with arrows. This diagrammatic representation illustrates a solution model to a given problem . showing the steps as boxes of various kinds.