Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome back to Software Development!

Similar presentations


Presentation on theme: "Welcome back to Software Development!"— Presentation transcript:

1 Welcome back to Software Development!

2 Algorithm Guidelines…

3 Algorithm Guidelines…
One action per step or flowchart box: Too many words in the step / box? Keep it short and sweet … 5-6 words per step / box. Conjunction Junction… And, or, but, unless, ... Likely more than one action in the step. Look for buried questions or decisions Looping words: continue, do, repeat (the flow arrows covers these) Decision words: is, if, ? “Keep the larger number” is a decision (if x > y) and an action (keep x)…2 steps

4 Flowcharting Recap…

5 Flowcharting Recap… Start or end of algorithm:

6 Flowcharting Recap… Start or end of algorithm: Leave the house

7 Flowcharting Recap… Start or end of algorithm: Leave the house
At school - done

8 Flowcharting Recap… Start or end of algorithm: Action/process step:
Leave the house At school - done

9 Flowcharting Recap… Start or end of algorithm: Action/process step:
Leave the house At school - done Start the car

10 Flowcharting Recap… Start or end of algorithm: Action/process step:
Input or output operation: Leave the house At school - done Start the car

11 Flowcharting Recap… Start or end of algorithm: Action/process step:
Input or output operation: Leave the house At school - done Start the car Ask for directions

12 Flowcharting Recap… Start or end of algorithm: Action/process step:
Input or output operation: Decision: Leave the house At school - done Start the car Ask for directions

13 Flowcharting Recap… Start or end of algorithm: Action/process step:
Input or output operation: Decision: Leave the house At school - done Start the car Ask for directions Is the stoplight red? Yes No

14 “Sorting a list of numbers” Algo
See if you can find a way to use your “largest number” or “smallest number” algorithm to sort a (any) list of numbers.

15 “Sorting a list of numbers” Algo Example

16 “Sorting a list of numbers” Algo Example
Start with full list

17 “Sorting a list of numbers” Algo Example
Start with full list Remember where start of list is

18 “Sorting a list of numbers” Algo Example
Start with full list Remember where start of list is Do

19 “Sorting a list of numbers” Algo Example
Start with full list Remember where start of list is Do Run “smallest number” algorithm on list

20 “Sorting a list of numbers” Algo Example
Start with full list Remember where start of list is Do Run “smallest number” algorithm on list – get smallest number

21 “Sorting a list of numbers” Algo Example
Start with full list Remember where start of list is Do Run “smallest number” algorithm on list – get smallest number Swap smallest number with first number in list

22 “Sorting a list of numbers” Algo Example
Start with full list Remember where start of list is Do Run “smallest number” algorithm on list – get smallest number Swap smallest number with first number in list New list starts with 2nd item

23 “Sorting a list of numbers” Algo Example
Start with full list Remember where start of list is Do Run “smallest number” algorithm on list – get smallest number Swap smallest number with first number in list New list starts with 2nd item While new list has #’s in it

24 “Sorting a list of numbers” Algo Example
Start with full list Remember where start of list is Do Run “smallest number” algorithm on list – get smallest number Swap smallest number with first number in list New list starts with 2nd item While new list has #’s in it Original list is now sorted

25 Get smallest # (smallest # algo) New list starts w/2nd item
Start w/full list Remember start of list Get smallest # (smallest # algo) Swap w/1st New list starts w/2nd item New list have #? No Yes Orig list is sorted

26 Loops

27 Loops Three keys to making a loop work:

28 Loops Three keys to making a loop work: Getting it started right

29 Loops Three keys to making a loop work: Getting it started right
Keeping it moving along

30 Loops Three keys to making a loop work: Getting it started right
Keeping it moving along Determining when to quit looping

31 Loops Three keys to making a loop work:
Getting it started right – initialization Keeping it moving along Determining when to quit looping

32 Loops Three keys to making a loop work:
Getting it started right – initialization Keeping it moving along – iteration Determining when to quit looping

33 Loops Three keys to making a loop work:
Getting it started right – initialization Keeping it moving along – iteration Determining when to quit looping – exit conditions

34 Get smallest # (smallest # algo) New list starts w/2nd item
Start w/full list Remember start of list Get smallest # (smallest # algo) Swap w/1st New list starts w/2nd item New list have #? No Yes Orig list is sorted

35 Get smallest # (smallest # algo) New list starts w/2nd item
Start w/full list Remember start of list Get smallest # (smallest # algo) Swap w/1st Loop New list starts w/2nd item New list have #? No Yes Orig list is sorted

36 Get smallest # (smallest # algo) New list starts w/2nd item
Start w/full list Initialization Remember start of list Get smallest # (smallest # algo) Swap w/1st Loop New list starts w/2nd item New list have #? No Yes Orig list is sorted

37 Get smallest # (smallest # algo) New list starts w/2nd item
Start w/full list Initialization Remember start of list Get smallest # (smallest # algo) Swap w/1st Loop New list starts w/2nd item Iteration get to next loop New list have #? No Yes Orig list is sorted

38 Get smallest # (smallest # algo) New list starts w/2nd item
Start w/full list Initialization Remember start of list Get smallest # (smallest # algo) Swap w/1st Loop New list starts w/2nd item Iteration get to next loop New list have #? No Exit condition Yes Orig list is sorted

39 Loops Boundary conditions

40 Loops Boundary conditions The limiting factors or conditions

41 Loops Boundary conditions
The limiting factors or conditions … the “edges”

42 Loops Boundary conditions
The limiting factors or conditions … the “edges” Weird/strange values that you suspect may break your algorithm

43 Loops “Largest number” boundary conditions:

44 Loops “Largest number” boundary conditions:
Having a wide range of numbers … number of digits

45 Loops “Largest number” boundary conditions:
Having a wide range of numbers … number of digits Negative numbers

46 Loops “Largest number” boundary conditions:
Having a wide range of numbers … number of digits Negative numbers Zero

47 Loops “Largest number” boundary conditions:
Having a wide range of numbers … number of digits Negative numbers Zero All numbers in the list the same

48 Loops “Largest number” boundary conditions:
Having a wide range of numbers … number of digits Negative numbers Zero All numbers in the list the same An extremely long list

49 Loops “Largest number” boundary conditions:
Having a wide range of numbers … number of digits Negative numbers Zero All numbers in the list the same An extremely long list An empty list

50 Loops “Largest number” boundary conditions:
Having a wide range of numbers … number of digits Negative numbers Zero All numbers in the list the same An extremely long list An empty list Largest number actually the first in the list

51 Loops “Largest number” boundary conditions:
Having a wide range of numbers … number of digits Negative numbers Zero All numbers in the list the same An extremely long list An empty list Largest number actually the first in the list Largest number actually the last in the list

52 Loops

53 Loops Every

54 Loops Every every

55 Loops Every every every

56 Loops Every every every every

57 Loops Every every every every loop must have an exit

58 Loops Every every every every loop must have an exit
Any arrow going back up is a loop

59 Loops Every every every every loop must have an exit
Any arrow going back up is a loop One of the most common causes of bugs

60 Loops Every every every every loop must have an exit
Any arrow going back up is a loop One of the most common causes of bugs For every loop, identify your boundary conditions

61 Loops Every every every every loop must have an exit
Any arrow going back up is a loop One of the most common causes of bugs For every loop, identify your boundary conditions Then test the loop for those boundary conditions

62 Loops Every every every every loop must have an exit
Any arrow going back up is a loop One of the most common causes of bugs For every loop, identify your boundary conditions Then test the loop for those boundary conditions For every loop, identify your termination/exit conditions

63 Loops Every every every every loop must have an exit
Any arrow going back up is a loop One of the most common causes of bugs For every loop, identify your boundary conditions Then test the loop for those boundary conditions For every loop, identify your termination/exit conditions Then test the loop for those exit conditions

64 Your Algorithms & Flowcharts

65 Your Algorithms & Flowcharts
Each of you…

66 Your Algorithms & Flowcharts
Each of you… Clean sheet of paper(s)

67 Your Algorithms & Flowcharts
Each of you… Clean sheet of paper(s) Neatly rewrite your algorithms and flowcharts:

68 Your Algorithms & Flowcharts
Each of you… Clean sheet of paper(s) Neatly rewrite your algorithms and flowcharts: “Largest number” algo

69 Your Algorithms & Flowcharts
Each of you… Clean sheet of paper(s) Neatly rewrite your algorithms and flowcharts: “Largest number” algo “Smallest number” algo

70 Your Algorithms & Flowcharts
Each of you… Clean sheet of paper(s) Neatly rewrite your algorithms and flowcharts: “Largest number” algo “Smallest number” algo “Sort a number list” algo

71 Your Algorithms & Flowcharts
Each of you… Clean sheet of paper(s) Neatly rewrite your algorithms and flowcharts: “Largest number” algo “Smallest number” algo “Sort a number list” algo Separate sheet for each

72 Your Algorithms & Flowcharts
Each of you… Clean sheet of paper(s) Neatly rewrite your algorithms and flowcharts: “Largest number” algo “Smallest number” algo “Sort a number list” algo Separate sheet for each This will go in your portfolio

73 Clear and Unclear Windows


Download ppt "Welcome back to Software Development!"

Similar presentations


Ads by Google