Post on 05-Jan-2016
FIT100FIT100
What's The Plan?Algorithmic Thinking
Step-by-step directions for whatever someone, or the
computer, needs to do
© 2004 Lawrence Snyder
FIT100FIT100Let’s Get Thinking.
• Activity: The Impossible Question In groups you will write out the instructions for how
to create a paper airplane. After you finish your instructions you will test them with another group. You will turn in: Instructions: Role Documentation: Test Results.
– FOUR ROLES» QUESTIONER: Write down all questions asked or problems posed
» ASSUMER: Write down all assumptions made.
» DOCUMENTER: Write down the algorithm.
» RESEARCHER: Gather information for your group
• Test Result Reflection: – Were all members of the group able to follow your
instructions– Did you have any unexpected results
FIT100FIT100
Instructions on how to build a paper airplane
FIT100FIT100Review: Paper Airplane
• Activity: Paper Airplane• How did the paper airplane activity
go?• What did you learn?• Are specific instructions easy to give?• Did you re-write your algorithm
between user tests?
FIT100FIT100Algorithm
• A precise, systematic method for producing a specified result
• In real life we do this all the time:
• What is a task that you complete daily where you do the same each time?
10-5
FIT100FIT100
FIT100FIT100
FIT100FIT100
FIT100FIT100
FIT100FIT100
Five Essential Properties of Algorithms
1. Input specified Data to be transformed during the
computation to produce the output Must specify type, amount, and form of
data
2. Output specified Data resulting from the computation—
intended result It is possible to have no output
10-10
FIT100FIT100
Five Essential Properties (cont'd)
3. Definiteness Specify the sequence of events Details of each step, including how to
handle errors
4. Effectiveness The operations are doable
5. Finiteness Must eventually stop
10-11
FIT100FIT100Let’s Get Thinking
• Activity: Creating a plan In groups of 4 you will get an algorithmic
task. Some of these tasks were used as interview questions. We are concerned with the process you follow to arrive at your solution.
– FOUR ROLES» QUESTIONER: Write down all questions asked or
problems posed
» ASSUMER: Write down all assumptions made.
» DOCUMENTER: Write down the algorithm.
» RESEARCHER: Gather information for your group
FIT100FIT100
An Example: Directions
• What is an algorithm for getting to the closest McDonald’s? Input? Output? Definiteness? Effectiveness? Finiteness?
FIT100FIT100
FIT100FIT100WEATHER
WHETHER
FIT100FIT100Context Matters
• Program can fulfil five properties of an algorithm, be unambiguous, and still not work right because it is executed in the wrong context e.g., last name in Western countries means family
name; in Asian countries it may mean given name
• Context matters: Driving instructions "From the Bothel Everett Highway go to Starbucks
and turn right." Assumes you are traveling in a specific direction. If
you are not, the directions will fail.10-16
FIT100FIT100Language in Algorithms
• Natural language For people, we use a natural language
like English Ambiguity is common in natural
language
• Programming Language Formal languages designed to
express algorithms Precisely defined; no ambiguity
10-17
FIT100FIT100Driving vs. Driverless
• http://www.youtube.com/watch?v=yDVLUiJfpPw
FIT100FIT100Program vs. Algorithm
• A program is an algorithm that has been customized to
solve a specific task
•under a specific set of circumstances
–using a specific language
• Algorithm is a general method; program is a specific method
10-19