150 likes | 175 Views
This announcement provides updates on upcoming assignments, discussions, and exams for CSSE221 Software Development Honors Day 17.
E N D
CSSE221: Software Dev. Honors Day 17 • Announcements • Fifteen and CarsTrucksTrains coming back • 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 • Markov due Wednesday 11:59 pm • I may post a more complete grading script when I finish it. • Homework 7 posted, due next Thursday. • 6 short written problems on data structures • Sierpinski gasket • Fibonacci exercise on recursion and tail recursion (will discuss today) • Schedule updated, some capsules shifted (threads next Tuesday, animation next Thursday)
Exam 1 90+ 8 80-90 6 70-80 12 60-70 3 0-60 3 Average: 79.5% Midterm averages: 90+ 12 80-90 10 (4 B+) 70-80 9 (4 C+) 60-70 0 0-60 1 Midterm grades submitted Statistics
This week: Markov • Monday: • Eclipse’s Debugger • Recursion, Sierpinski • Tuesday: • Review simulation project. • Capsule round 3: choose groups, discuss expectations • Wrap up recursion • Some time for Markov? • Thursday: • Fall Break!
Simulation Project • An educational simulation or animation of some process • Must include non-trivial use of 2 non-array data structures • The best ones are interactive • 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?
How to do a capsule?Round 3: +Lecture • Now you get to teach the whole topic to the class. • 45 minutes • Lecture (whiteboard or slides) • Demo • Hands-on activity • Quiz: integrated with your slides and demo/activity • Summary (If your slides contain details, then you may skip this)
Capsule Deliverables • By 7:30 am on the day you are presenting: • Email the summary or slides, quiz, and key to me (as before) • Commit your demo to csse221-200810-public • Include your section number in the project name: csse221 • Bring to class printed versions (as before): • 1 copy of summary • 2 copies of key • Enough copies of quiz for the class (20)
Other ideas • Still need roles (demo-driver, rover, questioner) • Add 1 or more people to present the slides • You’ll need to multi-task • You may move freely between modes (slides/live coding/activities)
How to give a great presentation! • Prepare! • Research: Know your stuff • Summarize: what are the 2-3 most important things I want them to get from this capsule? • Spend some time thinking about the flow • Rehearse the whole thing together • Delivery • Face your classmates • Make eye contact • Enunciate clearly and slowly
Capsule Rubric • New: • Context and motivation • Summary Explanation/correctness/organization • Presentation skills • Time (OK to go slightly under, but if you don’t rehearse, this could really bite you!)
Preference survey • In Angel > Lessons > Other. • Give choices for: • Capsule topic • Simulation ideas • Teammates for simulation project
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. 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. Tail Recursion • 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?
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: int foo(int n) { return fooHelper(n, {initial_solution}); } int fooHelper(int n, solution) { if (base case) { return solution; } return fooHelper(n-1, {new solution}); }
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(???, ???); } Factorial 1 n-1, soln * n • See how once we get to the base case, we are done?
Homework • The direct version makes 2 recursive calls. • The tail-recursive version only uses one call (with 2 extra parameters): huge performance boost! • 0, 1, 1, 2, 3, 5, 8, 13, …
Break • Then Markov time • I’ll pass back exams during this time