notes - You may call it, so long as:- You don't call it for...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
base case(s) - what can I handle directly? hard case(s) a) Can I break off and solve a small piece of this hard case? b) Can I express this hard case in terms of a slightly-less-hard case? c) Where do I do "my" part vs. the recursion doing "its" part? - after - before - between / both / etc. < <<<*>>> > d) "leap of faith" - you must BELIEVE that recursion works! Pretend that somebody already wrote this method for you.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: You may call it, so long as:- You don't call it for trivial cases- You can't just pass it the same parameter/state you received public static void printStars(int n) { if (n == 1) { S.o.p("*"); } else { S.o.p("*"); goodPrintStars(n - 1); } } // assume that this method is already written and works public static void goodPrintStars(int n) { ... }...
View Full Document

This note was uploaded on 01/04/2011 for the course CSE 143 taught by Professor Sr during the Spring '08 term at University of Washington.

Ask a homework question - tutors are online