Designing Software Algorithm definition A set of welldefined



















- Slides: 19
Designing Software • Algorithm definition – A set of well-defined instructions for carrying out a particular task. – Characteristics of a good algorithm : • Predictable – you know what it is supposed to do • Deterministic – it always does the same thing • Not subject to chance – tells you everything you need to know to do the task
Designing Software • Recipe analogy – Predictable … you know what the recipe makes – Deterministic … if you follow directions, comes out the same every time – Not subject to chance … provides you: • • • All the ingredients Measurements Every step and the order to do them in Cook times …everything you need to do it
Another Algorithm Task
Another Algorithm Task • Design an algorithm to locate the largest number in a list of numbers.
Another Algorithm Task • Design an algorithm to locate the largest number in a list of numbers. – Work in your team (both names on the sheet).
Another Algorithm Task • Design an algorithm to locate the largest number in a list of numbers. – Work in your team (both names on the sheet). – Be ready to share it with the class.
Another Algorithm Task • Design an algorithm to locate the largest number in a list of numbers. – Work in your team (both names on the sheet). – Be ready to share it with the class. – You will turn it in at the end of class.
Another Algorithm Task • Design an algorithm to locate the largest number in a list of numbers. – Work in your team (both names on the sheet). – Be ready to share it with the class. – You will turn it in at the end of class. – You have 15 minutes.
Algorithm Task Hints…
Algorithm Task Hints… • Pick a short, easy list of numbers to work with:
Algorithm Task Hints… • Pick a short, easy list of numbers to work with: – 2, 3, 1
Algorithm Task Hints… • Pick a short, easy list of numbers to work with: – 2, 3, 1 • Do the exercise yourself…and…
Algorithm Task Hints… • Pick a short, easy list of numbers to work with: – 2, 3, 1 • Do the exercise yourself…and… – As you do it, try to identify the individual actions you are performing.
Algorithm Task Hints… • Pick a short, easy list of numbers to work with: – 2, 3, 1 • Do the exercise yourself…and… – As you do it, try to identify the individual actions you are performing. – Ask: are there any decisions I’m making, any questions I’m asking?
Algorithm Task Hints… • Pick a short, easy list of numbers to work with: – 2, 3, 1 • Do the exercise yourself…and… – As you do it, try to identify the individual actions you are performing. – Ask: are there any decisions I’m making, any questions I’m asking? – Ask: are there steps that I repeat?
Algorithm Task Hints… • Pick a short, easy list of numbers to work with: – 2, 3, 1 • Do the exercise yourself…and… – As you do it, try to identify the individual actions you are performing. – Ask: are there any decisions I’m making, any questions I’m asking? – Ask: are there steps that I repeat? • How do I know I don’t need to repeat any more?
Algorithm Task Hints… • Pick a short, easy list of numbers to work with: – 2, 3, 1 • Do the exercise yourself…and… – As you do it, try to identify the individual actions you are performing. – Ask: are there any decisions I’m making, any questions I’m asking? – Ask: are there steps that I repeat? • How do I know I don’t need to repeat any more?
Algorithm Task Hints… • Pick a short, easy list of numbers to work with: – 2, 3, 1 • Do the exercise yourself…and… – As you do it, try to identify the individual actions you are performing. – Ask: are there any decisions I’m making, any questions I’m asking? – Ask: are there steps that I repeat? • How do I know I don’t need to repeat any more?
Your Task… • Design an algorithm to locate the largest number in a list of numbers. – Work in your team (both names on the sheet). – Be ready to share it with the class. – You will turn it in at the end of class. – You have 15 minutes.