Download presentation
Presentation is loading. Please wait.
Published byCornelius Fox Modified over 8 years ago
1
Algorithms Sept 4, 2006
2
Tuesday’s Lab You developed an algorithm Input – an 8 ½ x 11 inch piece of paper Audience – Fellow classmates Process – Instructions for making a particular type of airplane Output – A paper airplane that would fly
3
Problem Solving Problem solving is the act of finding a solution to a perplexing, distressing, vexing, or unsettled question.
4
A good algorithm – did your have these traits? Simple – Each step does one thing. No unnecessary steps. Precise – Unambiguous. Proper sequencing. Correct – The instructions told you to do the right things in the right order. Complete – Nothing was left out or left to your imagination. Abstraction – Probably not. A separate set of instructions that can be “substituted” in the algorithm. Ex. Fold = fold and crease.
5
Mnemonic S - Simple C - Complete R - coRrect A - has appropriate levels of Abstraction P - Precise
6
Problem solving Is about more than just writing an algorithm
7
Given a Problem Ask Questions... …to understand the problem – What do I know about the problem? – What is the information that I have to process in order to find the solution? – What does the solution look like? – What sort of special cases exist? – How will I recognize that I have found the solution?
8
Algorithms An algorithm is set of instructions for solving a problem or sub-problem in a finite amount of time using a finite amount of data
9
It has levels of Abstraction. From the Oxford English Dictionary, abstraction is defined as: – “The act or process of separating in thought, of considering a thing independently of its associations; or a substance independently of its attributes; or an attribute or quality independently of the substance to which it belongs.”
10
Or in other words The abstraction property lets us view an algorithm as a series of high level aggregate steps, with the detail hidden in a lower level.
11
Abstraction, cont. Instead of approaching a problem and worrying about each and every thing you must do to solve the problem, you can begin to look at the major steps. (Top down design) After the major steps, you can begin to fill in how you would accomplish the major step. That fill in may lead to the need for additional levels to fill in those details, etc.
12
Diagrammatically Drive the car to school Get directions Start the car Follow the directions Get parking pass Drive to the destination Turn left out of your driveway At the next light, turn right. At the intersection with I- 66, take the on-ramp for I-66 West … Level 1 Level 2 Level 3 Find a place to park Stop the car
13
Other algorithm attributes A good algorithm should be correct. A good algorithm should be complete. Shackelford again, “To be correct, an algorithm must produce results that are correct and complete given any and all sets of appropriate data.” And to be correct, an algorithm must proceed through to a conclusion.
14
Figure 6.3: The Interactions Between Problem-Solving Phases From Dale and Lewis website.
15
Let’s start refining our algorithms Precision involves unambiguous steps. Simplicity involves single steps in a correct sequence. Let’s look at a sample algorithm and follow it through. I am going to simulate a computer in this exercise, and you will do a similar exercise tomorrow in lab.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.