algorithms - roosevelt cs & web design · pseudo-code for planning 14 main design tool for...
TRANSCRIPT
![Page 2: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/2.jpg)
Algorithms
2
What is an algorithm ?Why do we need them ?How do we describe one ?Specify vs. implement !
![Page 3: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/3.jpg)
Algorithm
3
-- Oxford English Dictionary
from the Arabic al-Ḵuwārizmī, the native of Ḵwārazm, surname of the Arab mathematician Abu Ja'far Mohammed Ben Musa, who flourished early in the 9th cent., and through the translation of whose work on Algebra, the Arabic numerals became generally known in Europe.
![Page 4: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/4.jpg)
What is an algorithm?
A procedure for doing somethingA list of steps to accomplish a taskA structured method for solving a problem
4
![Page 5: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/5.jpg)
Algorithm examples
Recipes for cookingInstructions to assemble a productDescription of a sports playStrategy for searching the internetScheme for solving a problem
5
![Page 6: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/6.jpg)
Step-by-step
1. Do this2. Do that3. Do another thing4. Do something else
6
![Page 7: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/7.jpg)
Complexity
Simple algorithms are generally linearBut what happens when there are alternative choices ?Or unanticipated possibilities ?Things can get more complex...
7
![Page 8: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/8.jpg)
8
![Page 9: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/9.jpg)
Specify vs. implement
Specify: plan and designImplement: execute or run
9
![Page 10: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/10.jpg)
Specifying an algorithm
Natural language (narrative text)Flow chart (visual schematic)Pseudo-code (shorthand text)But not programming languages
10
![Page 11: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/11.jpg)
Natural language recipe
11
-- The Cape Cod Fish & Seafood Cookbook
![Page 12: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/12.jpg)
Flow chart procedure
12
-- http://en.wikipedia.org/wiki/File:LampFlowchart.svg
How many engineers does it take to fix a broken lamp ?
![Page 13: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/13.jpg)
Pseudo-code
13
Start the cat at the center of the stage
When the green flag is clicked:
Repeat 10 times:
Move the cat right 10 steps
Change its costume
Rotate it 10 degrees clockwise
Stop everything
![Page 14: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/14.jpg)
Pseudo-code for planning
14
Main design tool for planning softwareCapture the logic and flow of the algorithmDesign is independent of implementationCan be translated into many languagesPolyglottous programmers !!!
![Page 15: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/15.jpg)
Implementing an algorithm
World (cook the salmon)
Software (run the code)
15
![Page 16: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/16.jpg)
Algorithms are
Everywhere
16
![Page 17: Algorithms - Roosevelt CS & Web Design · Pseudo-code for planning 14 Main design tool for planning software Capture the logic and flow of the algorithm Design is independent of implementation](https://reader033.vdocuments.site/reader033/viewer/2022042005/5e6f629d42d5a2148905eea5/html5/thumbnails/17.jpg)
17