Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSSE221: Software Dev. Honors Day 17 Announcements Announcements Fifteen and CarsTrucksTrains coming back Fifteen and CarsTrucksTrains coming back Note:

Similar presentations


Presentation on theme: "CSSE221: Software Dev. Honors Day 17 Announcements Announcements Fifteen and CarsTrucksTrains coming back Fifteen and CarsTrucksTrains coming back Note:"— Presentation transcript:

1 CSSE221: Software Dev. Honors Day 17 Announcements Announcements Fifteen and CarsTrucksTrains coming back Fifteen and CarsTrucksTrains coming back Note: depending on complexity of code, you should use // internal comments as well as javadoc Note: depending on complexity of code, you should use // internal comments as well as javadoc Javadoc is for the user of the program; internal comments are for programmers; both are important Javadoc is for the user of the program; internal comments are for programmers; both are important Markov due Wednesday 11:59 pm Markov due Wednesday 11:59 pm I may post a more complete grading script when I finish it. I may post a more complete grading script when I finish it. Homework 7 posted, due next Thursday. Homework 7 posted, due next Thursday. 6 short written problems on data structures 6 short written problems on data structures Sierpinski gasket Sierpinski gasket Fibonacci exercise on recursion and tail recursion (will discuss today) Fibonacci exercise on recursion and tail recursion (will discuss today) Schedule updated, some capsules shifted (threads next Tuesday, animation next Thursday) Schedule updated, some capsules shifted (threads next Tuesday, animation next Thursday)

2 Statistics Exam 1 Exam 1 90+8 90+8 80-906 80-906 70-8012 70-8012 60-703 60-703 0-603 0-603 Average: 79.5% Average: 79.5% Midterm averages: 90+12 80-9010 (4 B+) 70-809 (4 C+) 60-700 0-601 Midterm grades submitted

3 This week: Markov Monday: Monday: Eclipse’s Debugger Eclipse’s Debugger Recursion, Sierpinski Recursion, Sierpinski Tuesday: Tuesday: Review simulation project. Review simulation project. Capsule round 3: choose groups, discuss expectations Capsule round 3: choose groups, discuss expectations Wrap up recursion Wrap up recursion Some time for Markov? Some time for Markov? Thursday: Thursday: Fall Break! Fall Break!

4 Simulation Project An educational simulation or animation of some process An educational simulation or animation of some process Must include non-trivial use of 2 non-array data structures Must include non-trivial use of 2 non-array data structures The best ones are interactive The best ones are interactive If yours coincides with a capsule topic… If yours coincides with a capsule topic… Don’t just copy one of the zillions of simulations out there that are pretty. but aren’t educational. Could you make yours actually help someone’s understanding? Don’t just copy one of the zillions of simulations out there that are pretty. but aren’t educational. Could you make yours actually help someone’s understanding?

5 How to do a capsule? Round 3: +Lecture Now you get to teach the whole topic to the class. Now you get to teach the whole topic to the class. 45 minutes 45 minutes Lecture (whiteboard or slides) Lecture (whiteboard or slides) Demo Demo Hands-on activity Hands-on activity Quiz: integrated with your slides and demo/activity Quiz: integrated with your slides and demo/activity Summary (If your slides contain details, then you may skip this) Summary (If your slides contain details, then you may skip this)

6 Capsule Deliverables By 7:30 am on the day you are presenting: By 7:30 am on the day you are presenting: Email the summary or slides, quiz, and key to me (as before) Email the summary or slides, quiz, and key to me (as before) Commit your demo to csse221-200810-public Commit your demo to csse221-200810-public Include your section number in the project name: csse221 Include your section number in the project name: csse221 Bring to class printed versions (as before): Bring to class printed versions (as before): 1 copy of summary 1 copy of summary 2 copies of key 2 copies of key Enough copies of quiz for the class (20) Enough copies of quiz for the class (20)

7 Other ideas Still need roles (demo-driver, rover, questioner) Still need roles (demo-driver, rover, questioner) Add 1 or more people to present the slides Add 1 or more people to present the slides You’ll need to multi-task You’ll need to multi-task You may move freely between modes (slides/live coding/activities) You may move freely between modes (slides/live coding/activities)

8 How to give a great presentation! Prepare! Prepare! Research: Know your stuff Research: Know your stuff Summarize: what are the 2-3 most important things I want them to get from this capsule? Summarize: what are the 2-3 most important things I want them to get from this capsule? Spend some time thinking about the flow Spend some time thinking about the flow Rehearse the whole thing together Rehearse the whole thing together Delivery Delivery Face your classmates Face your classmates Make eye contact Make eye contact Enunciate clearly and slowly Enunciate clearly and slowly

9 Capsule Rubric New: New: Context and motivation Context and motivation Summary  Explanation/correctness/organization Summary  Explanation/correctness/organization Presentation skills Presentation skills Time (OK to go slightly under, but if you don’t rehearse, this could really bite you!) Time (OK to go slightly under, but if you don’t rehearse, this could really bite you!)

10 Preference survey In Angel > Lessons > Other. In Angel > Lessons > Other. Give choices for: Give choices for: Capsule topic Capsule topic Simulation ideas Simulation ideas Teammates for simulation project Teammates for simulation project

11 Tail Recursion int fact(int n) { if (n<=1) { return 1; return n * fact(n-1); } Once we reach the base case, we need to do all the multiplications as we empty the call stack. Once we reach the base case, we need to do all the multiplications as we empty the call stack. int gcd(a,b) { if (a % b == 0) return b; return gcd(b, a % b); } Here, once we reach the base case, we are done. This is called a tail-recursive function. In a tail-recursive function, the info that needs to be stored on the call stack is much smaller. In a tail-recursive function, the info that needs to be stored on the call stack is much smaller. Can we make factorial tail-recursive? Can we make factorial tail-recursive?

12 Tail Recursion Template We can make many methods tail-recursive, by using a helper method with a second parameter to hold a partial solution. Template: We can make many methods tail-recursive, by using a helper method with a second parameter to hold a partial solution. Template: int foo(int n) { return fooHelper(n, {initial_solution}); } int fooHelper(int n, solution) { if (base case) { if (base case) { return solution; } return fooHelper(n-1, {new solution}); }

13 Factorial Direct recursion: int fact(int n) { if (n<=1) { return 1; return n * fact(n-1); } Tail-recursive: int fact(int n) { return factHelper(n, ???) } int factHelper(int n, soln) { if (n<=1) { return soln; } return factHelper(???, ???); } See how once we get to the base case, we are done? See how once we get to the base case, we are done? 1 n-1, soln * n

14 Homework The direct version makes 2 recursive calls. The direct version makes 2 recursive calls. The tail-recursive version only uses one call (with 2 extra parameters): huge performance boost! The tail-recursive version only uses one call (with 2 extra parameters): huge performance boost! 0, 1, 1, 2, 3, 5, 8, 13, … 0, 1, 1, 2, 3, 5, 8, 13, …

15 Tail Recursion Verbiage A recursive function is said to be tail recursive if there are no pending operations to be performed on return from a recursive call. A recursive function is said to be tail recursive if there are no pending operations to be performed on return from a recursive call. Tail recursive functions are often said to "return the value of the last recursive call as the value of the function." Tail recursive functions are often said to "return the value of the last recursive call as the value of the function." Tail recursion is very desirable because the amount of information which must be stored during the computation is independent of the number of recursive calls. Tail recursion is very desirable because the amount of information which must be stored during the computation is independent of the number of recursive calls. Some modern computing systems will actually compute tail-recursive functions using an iterative process. Some modern computing systems will actually compute tail-recursive functions using an iterative process. Source: http://triton.towson.edu/~akayabas/COSC455_Spring2000/Recursion_Iteration.htm

16 Break Then Markov time Then Markov time I’ll pass back exams during this time I’ll pass back exams during this time


Download ppt "CSSE221: Software Dev. Honors Day 17 Announcements Announcements Fifteen and CarsTrucksTrains coming back Fifteen and CarsTrucksTrains coming back Note:"

Similar presentations


Ads by Google