Presentation on theme: "PRINCIPLES OF COMPUTATION PROBLEM SOLVING. WHAT IS COMPUTATION & COMPUTING Computation is a process of performing computations or calculations. Just."— Presentation transcript:
WHAT IS COMPUTATION & COMPUTING Computation is a process of performing computations or calculations. Just think of Gringotts bank in Harry Potter and the calculations that the Goblins were performing at the desks. Back in the day these calculations were done by humans, but as computers became more main stream they took over the work Computing is the study of natural science. It’s important to understand that computing isn’t just fixed to man-made items such as Xboxs, iPods etc There are strands of computing such as Nanocomputing – molecular-scale computing DNA Computing
ALGORITHMS Define: a description, independent of any programming language, of a process that achieves some task. It is a step-by-step procedure for solving a problem In a small way an algorithm is a way of stripping down a complex task into it’s easiest form. The main objective to creating an algorithm is to find the fastest and shortest algorithm possible Just remember, you create algorithms every time you code.
ALGORITHM EXAMPLE The best example of an algorithm is the London underground map
CHALLENGE TIME Is there a route that a sales person can take through every city starting at city A with a cost of £480 as a maximum. B C D A E G F 100 120 70 80 70 90 110 40 50 30 70 60
PLANNING AN ALGORITHM Algorithms don’t need to relate to computers take changing a wheel for example First Draft 1. Loosen the wheel nuts from the flat tyre 2. Get the spare tyre from the boot of the car 3. Jack up the car 4. Remove the wheel with the flat tyre 5. Fit spare tyre and tighten the wheel nuts 6. Lower the car 7. Secure the jack and flat tyre in the boot After refinements 1. Loosen the wheel nuts from the flat tyre 2. Get the spare tyre from the boot of the car 3. Jack up the car 1. Place the jack under the car near the wheel with the flat tyre 2. Insert the jack handle in the jack 3. Place a brick or wooden block under a wheel to stop the car from rolling off the jack 4. Jack up the car until there’s enough room to fit the spare tyre 1. Move the jack handle repeatedly until the car is high enough off the ground for the spare tyre to be put on the wheel 4. Remove the wheel with the flat tyre 5. Fit spare tyre and tighten the wheel nuts 6. Lower the car 7. Secure the jack and flat tyre in the boot
QUESTION TIME Hand trace the following algorithm using as input numbers 2, 6, 34, 12, 0 nResult 0 2 Code Result 0 Repeat Input n Result Result + n Until n = 0