Introduction to problem solving. Introductory Discussion? What problems are you faced with daily? Do you think a computer can be designed to solve those.

Slides:



Advertisements
Similar presentations
Data Dependencies Describes the normal situation that the data that instructions use depend upon the data created by other instructions, or data is stored.
Advertisements

Justification-based TMSs (JTMS) JTMS utilizes 3 types of nodes, where each node is associated with an assertion: 1.Premises. Their justifications (provided.
How Do You Make a Program Wait?. 1. What is an algorithm? 2. Can you think of a reason why it might be inconvenient to program your robot to always go.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Algorithmic Thinking What’s the Plan? lawrence snyder c h a p t e r 10.
? What is Computer Science and what can you do with it.
Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the five essential properties of an algorithm.
Chapter 10 What's The Plan?: Algorithmic Thinking.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Computers CS Dr. Zhizhang Shen Chapter 10: How to.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers.
Chapter 2: Algorithm Discovery and Design
Chapter 1 Introduction to Object- Oriented Programming and Problem Solving.
Programming Fundamentals (750113) Ch1. Problem Solving
1 Discrete Optimization. 2 The relationship between counting techniques/graph theory and discrete optimization Adding a goal (objective function) to a.
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
Algebra Problems… Solutions Algebra Problems… Solutions © 2007 Herbert I. Gross Set 5 By Herbert I. Gross and Richard A. Medeiros next.
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
CHP - 9 File Structures. INTRODUCTION In some of the previous chapters, we have discussed representations of and operations on data structures. These.
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
Introduction to Programming Concepts & Logic
Artificial Intelligence Lecture 9. Outline Search in State Space State Space Graphs Decision Trees Backtracking in Decision Trees.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Invitation to Computer Science, Java Version, Second Edition.
PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.
Program Development Life Cycle (PDLC)
Fundamentals of Algorithms MCS - 2 Lecture # 1
Algorithms and their Applications CS2004 ( ) Dr Stephen Swift 1.2 Introduction to Algorithms.
Professional IT Roles Investigate IT professional roles. Find out what each role involves, what the job entails. Identify what personal qualities are needed.
Algorithms CS139 – Aug 30, Problem Solving Your roommate, who is taking CS139, is in a panic. He is worried that he might lose his financial aid.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
Office of School Improvement Differentiated Webinar Series Formative Assessment – Feedback February 28,2012 Dr. Dorothea Shannon, Thomasyne Beverly, Dr.
Introduction to Programming Concepts & Logic COP1006 with Dr. Meg McManus McManusCOP10061.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
What's The Plan? Algorithmic Thinking Step-by-step directions for whatever someone, or the computer, needs to do © 2004 Lawrence Snyder.
Introduction to problem solving.
Adding and Subtracting Decimals © Math As A Second Language All Rights Reserved next #8 Taking the Fear out of Math 8.25 – 3.5.
Chapter 10 Algorithmic Thinking. Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the.
Algorithms CS280 – 10/20/05. Announcement  Part 1 of project 2 due.  Read chapters 10, 7 for this unit  Tuesday we will also be in the classroom We.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Installing Java on a Home machine For Windows Users: Download/Install: Go to downloads html.
Algorithms and Pseudocode
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
PROBLEM SOLVING. What is a Problem? A problem is a situation that needs to be resolved.
COP1006 with Dr. Meg McManus McManus COP  Course Outline  Asthma & Allergies  Course Website  Tests  Assignments McManusCOP10062.
Data Structures and Algorithm Analysis Dr. Ken Cosh Linked Lists.
Algorithms Sept 4, Tuesday’s Lab You developed an algorithm Input – an 8 ½ x 11 inch piece of paper Audience – Fellow classmates Process – Instructions.
11 Making Decisions in a Program Session 2.3. Session Overview  Introduce the idea of an algorithm  Show how a program can make logical decisions based.
How Do You Make a Program Wait?
The Need for Algorithms
JavaScript/ App Lab Programming:
ICS 3UI - Introduction to Computer Science
Mile-long hurdle race Suppose that we want to program Karel to run a one-mile long hurdle race, where vertical wall sections represent hurdles. The hurdles.
INTRODUCTION TO PROBLEM SOLVING
Algorithm and Ambiguity
Algorithm and Ambiguity
Unit# 9: Computer Program Development
Algorithm and Ambiguity
Chapter 10: Algorithm TECH Prof. Jeff Cheng.
What's The Plan?: Algorithmic Thinking
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
Basic Concepts of Algorithm
What's The Plan?: Algorithmic Thinking
What's The Plan?: Algorithmic Thinking
Presentation transcript:

Introduction to problem solving

Introductory Discussion? What problems are you faced with daily? Do you think a computer can be designed to solve those problems? Do you think that the computer is smarter than a human? Discuss.

The Role of the Computer Programmer Computers are designed to solve problems speedily and accurately. There is no problem that can be solved by a computer that cannot be solved by humans as well. It is just that it would take considerably longer for humans to solve it and the degree of accuracy would not be the same. Although computers are used to solve problems, they do not have brains. They cannot think. They cannot reason, although recent advances in artificial intelligence may seem to suggest otherwise. A computer is a moron – it simply does exactly what we tell it to do. This is why the role of the computer programmer is so important. There is nothing magical about the way computers solve problems. A computer simply follows (executes) a set of instructions given to it by the programmer and produces the specified results.

The Role of the Computer Programmer The computer programmer creates the instructions for the computer programmer to follow. If the computer produces undesirable results, it is not the computer’s fault; it is the programmer’s fault. Consider the following analogy: The food processor has buttons that indicate the various functions that can be performed – chop, grate, puree, liquefy, and so on. Now suppose you want chop some carrots to make a stew. You place the carrots in the food processor and press the chop button, but instead of chopping the carrots, the food processor purees it. The result is a stew that looks like a mush. Who would you blame for this undesired result? Would it be the food processor, the designer or yourself (the user)? Discuss

The Role of the Computer Programmer In this case:  The user did what he was supposed to do (that is, press the chop button)  The food processor did what it was supposed to do, that is, it carried out the instructions associated with the chop button.  The designer is at fault here. Clearly the incorrect instructions were linked to the chop button. In a similar way, a computer carries out the instructions given to it by the programmer. The programmer must, therefore, ensure that the correct instructions are given at all times, and that the instructions are precise (accurate) and unambiguous (clear). Otherwise the results might be undesirable and in some critical situation such as airline navigation, the result could be fatal.

The Role of the Computer Programmer CLASS DISCUSSION 1.Why are computers built to solve problems that the human brain can solve? 2.Give some scenarios in which undesirable instructions in a computer can be fatal? 3.How is a computer able to solve problems? 4.A freezer was turned up to level 7 so that items could get well- frozen; the items were defrosted instead. What could be the cause of the error?

How are instructions given to the Computer? Instructions are given to the computer in the form of computer programs.  A computer program is a finite set of precise instructions, written in a programming language. Before we write a computer program, we first have to find a way to solve the problem at hand. After we have figured out how to solve the problem, we then translate the solution into a language that is meaningful to the computer. Giving instructions to a computer can be challenging at times and require a certain amount of skill. This is because giving precise, unambiguous instructions is not inherent in human nature. Humans tend to make assumptions when giving instructions and they expect other humans to reason things out in order to get to a logical conclusion.

How are instructions given to the Computer? Consider the following problem: You would like to give directions to someone to get to the nearest post office starting at point A. A possible set of instructions might be: 1.Proceed a mile or so down the road until you reach the roundabout. 2.Turn left at the roundabout and follow the road until you see a green house on the right hand-side. 3.The post office is about the 3 rd or 4 th building on the right after the green house. You’ll see the sign in front, you cant miss it. CLASS DISCUSSION DO YOU THINK THE INSTRUCTIONS ARE UNAMBIGUOUS AND PRECISE? What would you change or add to the instructions?

How are instructions given to the Computer? To the average person, the above instruction may appear to be clear and straightforward. However, once you start the following instructions, you may find that vital pieces of information may have been omitted and other bits of information might not be as precise as they could have been. For example, one might find that there is a junction or a fork in the road before one reaches the roundabout. This vital information was omitted so when the person arrives at the junction he/she would have to make a decision as to which way to proceed. Do I turn right, left or proceed straight ahead? Making the wrong decision could lead to all sorts of consequences.

How are instructions given to the Computer? Let us carefully assess each instruction: 1. “Proceed a mile or so” is imprecise. How far should the person have to walk or drive before arriving at the roundabout? 2. What if there is more than one green house on the right? The instruction should precisely state whether it is the first, second or third green house that is being referred to. 3. In the third instruction, it might not be difficult for a person to figure out whether or not the post office is the 3 rd or 4 th building. However, it would be impossible for a computer to execute on instructions written in this form. Computers must be told exactly what they must do in the correct sequence. We call the set of instructions an ALGORITHM.

How are instructions given to the Computer? ALGORITHMS HAVE FOUR VERY IMPORTANT ATTRIBUTES. They must be precise

How are instructions given to the Computer? ALGORITHMS HAVE FOUR VERY IMPORTANT ATTRIBUTES. They must be precise They must be unambiguous

How are instructions given to the Computer? ALGORITHMS HAVE FOUR VERY IMPORTANT ATTRIBUTES. They must be precise They must be unambiguous They must be finite, that is, terminate after a finite number of steps

How are instructions given to the Computer? ALGORITHMS HAVE FOUR VERY IMPORTANT ATTRIBUTES. They must be precise They must be unambiguous They must be finite, that is, terminate after a finite number of steps The instructions must be in a logical sequence

It is important to note that: Writing a program is simply a formal way of giving instructions to someone (in this case the computer) to perform a particular task. The only difficulty in writing a program is in knowing how to solve the problem. If you do not know how to get to the post office, you would not be able to give directions to someone. Likewise a programmer must figure out a way to solve the problem before he/she proceeds to tell the computer what it should do. How are instructions given to the Computer?

CLASS ACTIVITY Arrange yourselves in groups of 4 or 5. Write the step by step instructions to solve one of the following everyday problem (10-minute exercise): 1.Write a recipe for making a cheese omelette. 2.Write the instructions to teach your mom how to retrieve voice messages from generic cell phone. 3.Write instructions to give directions to a visitor to get to the Public Hospital from the school premises. 4.Write instructions to tell a novice how to download music from the internet. 5.Write the instructions necessary to determine if an unknown substance contains protein. 6.Write a recipe to make a glass of lemonade. Note: No more than two groups should work on a particular problem. The instructions should be written on the board by a group member; the class should discuss the instructions given using the 4 attributes of algorithms to substantiate their suggestions.

CLASS DISCUSSION How are instructions given to a computer? Before instructions are given to a computer, what steps should be taken? Instructions given to a computer should have 4 important attributes; what are they? Discuss the importance of each attributes using relevant examples. How are instructions given to the Computer?

Problem-solving on the Computer 2 Major Phases for the design of any computer program

Problem-solving on the Computer 2 Major Phases for the design of any computer program Problem-Solving Phase Implementation Phase

Problem-solving on the Computer 2 Major Phases for the design of any computer program Problem-Solving Phase Implementation Phase Step 1: Define the problem Step 2: Find a solution to the problem Step 3: Evaluate alternative solutions Step 4: Represent the most efficient solution as an algorithm Step 5: Test the algorithm for correctness

Problem-solving on the Computer 2 Major Phases for the design of any computer program Problem-Solving Phase Implementation Phase Step 1: Define the problem Step 2: Find a solution to the problem Step 3: Evaluate alternative solutions Step 4: Represent the most efficient solution as an algorithm Step 5: Test the algorithm for correctness Step 1: Translate the algorithm into a specific programming language. Step 2: Execute the program on the computer. Step 3: Maintain the program