1 / 13

Problems and Algorithms

Problems and Algorithms. Polya’s Problem Solving Steps. George Polya , a famous mathematician, is known for creating four steps for easy problem solving.

menora
Download Presentation

Problems and Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Problems and Algorithms

  2. Polya’s Problem Solving Steps • George Polya, a famous mathematician, is known for creating four steps for easy problem solving. • “Trying to solve problems, you have to observe and to imitate what other people do when solving problems and, finally, you learn to do problems by doing them.”

  3. The Steps • Polya’s steps are:1. Define what the problem is2. Plan what the solution will be3. Implement the solution to the problem4. Look back • Sound familiar…

  4. Define the problem:When we’re required to solve a problem it’s important that we firstly need to define what it is. We must also make sure that we’re able to define that we’re looking at the correct problem. • Plan the solution:Next we need to consider the steps to be undertaken. The technical term for these steps is an “algorithm”. The term algorithm can be applied to almost any daily activity. In computing planning a solution is designing an algorithm.

  5. Implement the solution:Implementation means describing the algorithm design in a language the computer understands. Such a description is called a program, the language is known as a programming language. Once a program is written we have then to get the computer to execute the program. It is wise to document the steps taken so that it is easier to revise or improve at a later time. • Look back:The final stage we look back to ensure that the process carried out corresponds with the task we set out. From here we can look to see how we can improve on earlier steps.

  6. A little more on algorithms • An algorithm is a description of how to carry out a process. The agent who carries it out is known as the processor. So a computer is a processor. • Algorithms can be any daily event that requires a series of steps and an agent to carry them out.

  7. Examples

  8. In all of these cases the processor is a person who processes simple skills and who is equipped with simple tools. Provided that the algorithm is followed and implemented the processor will produce the desired result. • Many processes need to interact with their environment, accepting input and developing output. In the examples input could have been wool, flour, water, plastic parts etc. • The specification of input and output is an integral part of an algorithm description. Should the input be invalid there may be an inability to process or undesirable output. For example putting soap powder in bread mix would produce inedible bread.

  9. Processes • All the processes undertaken eventually end. The jumper is completed, the bread baked and the car finished. Some will continue however:e.g. keeping healthy • Similarly this will happen with computer processes with an indefinite termination point:e.g. controlling traffic lights, keeping satellite communications functioning

  10. Errors • There are three types of errors you will confront. • Syntax errors are errors in the expression or syntax of an algorithm that makes it unintelligible to the processor. These are generally spelling mistakes, misnaming objects or symbols that cannot be processed.

  11. A run time error is encountered when it is impossible for the processor to carry out an instruction. For example if you were instructed to pour two litres of milk into a container that could only hold one. Although it could be correct in syntax it may be impossible to carry out. • Logic errors are the hardest to detect, although there may be no other errors incorrect results may be returned. Test data needs to be applied to an algorithm to check the correctness of its logic.

  12. Quick Questions • What are the four steps Polya defines? • What is an algorithm? • Can you name a programming language? • Why is it important to look back when solving a problem? • Baking a cake is an example of a process.A) In what form is the appropriate algorithm usually expressed?B) What’s an example of simple steps carried out in the algorithm?C) What is the input?D) What is the output?E) How would we look back? • Which of these processes can be expected to terminate? Which won’t and why?A) Mixing bread doughB) Using a manual method to write 3/11 as a decimalC) The search for the loch ness monsterD) Cooking stir-fry vegetables

  13. Describe what invalid input would be for these processes:A) Building a model aeroplaneB) Making a pot of teaC) Logging on to a computer networkD) Operating a public telephoneE) Dividing one whole number by another • What is:A) Syntax ErrorB) Logic ErrorC) Runtime error

More Related