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!
Return graded assignments Review classroom procedures: Start of class procedure Reminders: Missing assignments Friday quiz – open book

2 Basic Flowchart Symbols
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

3 Largest Number Algorithm
Take the 1st number – at the start, it is the largest we’ve seen Do Get the next number from the list Compare the current largest to the next number If the next number is larger Then take it as the largest Until there are no more numbers left The number you are left with is the largest

4

5 Get 1st # as largest Get nxt # Compare nxt to largest Nxt # larger?
Yes Nxt is new largest No Flowchart for my algo Emphasize Loop is obvious Decisions are obvious Loop termination condition…end of list General…works for any list of numbers Only specific is starting in the list (1st item in list) More #’s ? Yes No Done!

6 Task: find the largest number in a list of integers

7 Task: find the largest number in a list of integers
Possible Algorithm:

8 Task: find the largest number in a list of integers
Possible Algorithm: Get the list

9 Task: find the largest number in a list of integers
Possible Algorithm: Get the list Get the biggest number from the list

10 Task: find the largest number in a list of integers
Possible Algorithm: Get the list Get the biggest number from the list Done

11 Task: find the largest number in a list of integers
Possible Algorithm: Get the list Get the biggest number from the list Done

12 Task: find the largest number in a list of integers
Possible Algorithm: Get the list Get the biggest number from the list Done All you are doing is restating the problem…

13 Task: find the largest number in a list of integers

14 Task: find the largest number in a list of integers
Algorithm:

15 Task: find the largest number in a list of integers
Algorithm: Get the list

16 Task: find the largest number in a list of integers
Algorithm: Get the list Sort the list from smallest to largest

17 Task: find the largest number in a list of integers
Algorithm: Get the list Sort the list from smallest to largest Take the largest number

18 Task: find the largest number in a list of integers
Algorithm: Get the list Sort the list from smallest to largest Take the largest number Done

19 Task: find the largest number in a list of integers
Algorithm: Get the list Sort the list from smallest to largest Take the largest number Done

20 Task: find the largest number in a list of integers
Algorithm: Get the list Sort the list from smallest to largest Take the largest number Done

21 Task: find the largest number in a list of integers
Algorithm: Get the list Sort the list from smallest to largest Take the largest number Done You’ve actually created a harder problem that includes this one!

22 Algorithm Guidelines…

23 Algorithm Guidelines…
One action per step or flowchart box:

24 Algorithm Guidelines…
One action per step or flowchart box: Too many words in the step / box?

25 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.

26 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…

27 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, ...

28 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.

29 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

30 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)

31 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, ?

32 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

33 Broken down enough?

34 Broken down enough? Swap “this” and “that” number in the list

35 Broken down enough? Swap “this” and “that” number in the list
Is this one step?

36 Broken down enough? Swap “this” and “that” number in the list
Is this one step? Actually no…

37 Broken down enough? Swap “this” and “that” number in the list
Is this one step? Actually no… 1) Get a temporary copy of “this” number

38 Broken down enough? Swap “this” and “that” number in the list
Is this one step? Actually no… 1) Get a temporary copy of “this” number 2) Move “that” number to “this” number’s slot

39 Broken down enough? Swap “this” and “that” number in the list
Is this one step? Actually no… 1) Get a temporary copy of “this” number 2) Move “that” number to “this” number’s slot 3) Move “this” number to “that” number’s old slot

40 Broken down enough? Swap “this” and “that” number in the list
Is this one step? Actually no… 1) Get a temporary copy of “this” number 2) Move “that” number to “this” number’s slot 3) Move “this” number to “that” number’s old slot If you understand this, you can put “swap A with B” as a flowchart step

41 Broken down enough? Swap “this” and “that” number in the list
Is this one step? Actually no… 1) Get a temporary copy of “this” number 2) Move “that” number to “this” number’s slot 3) Move “this” number to “that” number’s old slot If you understand this, you can put “swap A with B” as a flowchart step When you code it, you will need to actually code the above steps

42 Practice Guided practice Rewrite “largest number” algo
Focus on general solution Loop termination condition Flowchart your algo Team effort Turn in at end of class…graded. FINISH ALGO BEFORE STARTING FLOWCHART! About 30 mins

43 Practice Review and rewrite your “select the largest number” algorithm for clarity and conciseness.

44 Practice Review and rewrite your “select the largest number” algorithm for clarity and conciseness. Flowchart your “select the largest number” algorithm.

45 Practice Review and rewrite your “select the largest number” algorithm for clarity and conciseness. Flowchart your “select the largest number” algorithm. You have 30 minutes…

46 Hmm, an idea… Demonstrate power of a general algo
Simple change solves a different problem What change needed to find smallest number? 10 minutes, group work

47 Hmm, an idea… What would you have to do to your “largest number” algorithm to make it a “smallest number” algorithm?

48 Hmm, an idea… What would you have to do to your “largest number” algorithm to make it a “smallest number” algorithm? Just change your comparison decision!

49 A Harder Task Extend and reinforce power of general solution.
Use either algos to develop algo to sort a list of numbers Tool box reminder: Algos are tools to be used Keep a “tool box” of your valuable tools Use the right tool for the job Rest of class (30 minute goal) Close with “clear/unclear windows”

50 A Harder Task See if you can find a way to use your “largest number” or “smallest number” algorithm to sort a (any) list of numbers.

51 A Harder Task See if you can find a way to use your “largest number” or “smallest number” algorithm to sort a (any) list of numbers. Work with your partner

52 A Harder Task See if you can find a way to use your “largest number” or “smallest number” algorithm to sort a (any) list of numbers. Work with your partner Names on your work paper

53 A Harder Task See if you can find a way to use your “largest number” or “smallest number” algorithm to sort a (any) list of numbers. Work with your partner Names on your work paper Turn in at end of class

54 A Harder Task See if you can find a way to use your “largest number” or “smallest number” algorithm to sort a (any) list of numbers. Work with your partner Names on your work paper Turn in at end of class You have about 30 minutes…

55 Clear and Unclear Windows
Tomorrow: Continue sorting algo Loops exploration


Download ppt "Welcome back to Software Development!"

Similar presentations


Ads by Google