Chapter 1 INTRODUCTION TO PROBLEM SOLVING AND PROGRAMMING.pptx
Document Details
Uploaded by IntelligentJasper852
Full Transcript
INTRODUCTION TO PROBLEM SOLVING AND PROGRAMMING Chapter One General Problem-Solving Concepts OVER VIEW ▪ Problem Solving in Everyday Life ▪ Types of Problems ▪ Problem Solving with Computers ▪ Difficulties with Problem Solving OBJECTIVE ▪ When you have finished this chapter, you should be able to: 1...
INTRODUCTION TO PROBLEM SOLVING AND PROGRAMMING Chapter One General Problem-Solving Concepts OVER VIEW ▪ Problem Solving in Everyday Life ▪ Types of Problems ▪ Problem Solving with Computers ▪ Difficulties with Problem Solving OBJECTIVE ▪ When you have finished this chapter, you should be able to: 1. Describe the difference between heuristic and algorithmic solutions to problems. 2. List and describe the six problem-solving steps to solve a problem that has an algorithmic solution. 3. Use the six problem-solving steps to solve a problem. PROBLEM SOLVING IN EVERYDAY LIFE ▪ People make decisions every day to solve problems that affect their lives. ▪ The problems may be as unimportant as what to watch on television or as important as choosing a new profession. ▪ If a bad decision is made, time and resources are wasted, so it’s important that people know how to make decisions well. STEPS OF PROBLEM SOLVING ▪ To ensure the best decision solution for a given problem following six steps need to follow: 1. Identify the problem. (make sure you identify the problem before you start solving it. If you don’t know what the problem is, you cannot solve it.) 2. Understand the problem. 3. Identify alternative ways to solve the problem. 4. Select the best way to solve the problem from the list of alternative solutions. 5. List instructions that enable you to solve the problem using the selected solution. 2. UNDERSTAND THE PROBLEM. ▪ You must understand what is involved in the problem before you can continue toward the solution. ▪ This includes understanding the knowledge base of the person or machine for whom you are solving the problem. If you are setting up a solution for a person, then you must know what that person knows. ▪ When you are working with a computer, its knowledge base is the limited instructions the computer can understand in the particular language. ▪ For example to solve a problem involving calculus, you must know calculus; to solve a problem involving accounting, you must know accounting. ▪ You must be able to communicate with your client and be able to understand what is involved in solving the problem. 3. IDENTIFY ALTERNATIVE WAYS TO SOLVE THE PROBLEM. ▪ This list should be as complete as possible. You might want to talk to other people to find other solutions than those you have identified. Alternative solutions must be acceptable ones. ▪ Question: what is the sum of the first 100 whole numbers? ▪ 1st way: S = n[2a+(n-1)d]/2 ▪ 2nd way: S=(n(n+1))/2 4. SELECT THE BEST WAY TO SOLVE THE PROBLEM FROM THE LIST OF ALTERNATIVE SOLUTIONS. ▪ Identify and evaluate the pros and cons of each possible solution before selecting the best one. ▪ In order to do this, you need to select criteria for the evaluation. 5. LIST INSTRUCTIONS THAT ENABLE YOU TO SOLVE THE PROBLEM USING THE SELECTED SOLUTION. ▪ These numbered, step-by-step instructions must fall within the knowledge base set up in step 2. ▪ No instruction can be used unless the individual or the machine can understand it. 6. EVALUATE THE SOLUTION. ▪ Evaluate or test a solution to check its result to see if it is correct, and to see if it satisfies the needs of the person(s) with the problem. ▪ If the result is either incorrect or unsatisfactory, then the problem solver must review the list of instructions to see that they are correct or start the process all over again. TYPES OF PROBLEMS 1. Problem with Algorithmic Solution: can be solved with a series of actions. (the solution can be reached by completing these actions in steps) Example: ▪ find the maximum among set of numbers ▪ Calculate the average of a set of number ▪ Check the prime number ▪ Find the factorial 2. Problem with Heuristic Solutions: solutions that cannot be reached through a direct set of steps, solutions require reasoning built on knowledge and experience, and a process of trial and error. Example: ▪ Company expansion ▪ Hire new stuff ▪ Prescribe a medicine for a patient ▪ how to buy the best stock EXAMPLE: HEURISTIC PROBLEM ▪ Step 1: Problem definition ▪ At a café, there are 3-legged chairs and 4-legged chairs for customers to sit on. You count 15 stools with a total of 50 legs altogether. How many 3-legged stools are there in the café? ▪ Step 2: Understanding the problem (through asking guiding questions). PROBLEM SOLVING WITH COMPUTERS ▪ Solution means the instructions followed for problem solving, the instructions that must be followed to produce the best results. ▪ Results means the outcome or the completed computerassisted answer. ▪ Program means the set of instructions that make up the solution after they have been coded into a particular computer language. DIFFICULTIES WITH PROBLEM SOLVING ▪ Inadequate solution steps ▪ Incorrect problem definition ▪ Incorrect logic sequence ▪ Incorrect solution evaluation NEW TERMS ▪ Algorithm ▪ Program ▪ Solution ▪ Results ▪ Heuristic Solution ▪ Algorithmic Solution