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.”
Polya’s steps are: 1. Define what the problem is 2. Plan what the solution will be 3. Implement the solution to the problem 4. Look back Sound familiar…
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.
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.
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.
ProcessExpression of algorithm Processor Knitting a jumper Knitting a pattern Human being or knitting machine Baking breadRecipeBaker Building a model car Assembly instructions Hobbyist
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.
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
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.
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.
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 dough B) Using a manual method to write 3/11 as a decimal C) The search for the loch ness monster D) Cooking stir-fry vegetables
Describe what invalid input would be for these processes: A) Building a model aeroplane B) Making a pot of tea C) Logging on to a computer network D) Operating a public telephone E) Dividing one whole number by another What is: A) Syntax Error B) Logic Error C) Runtime error