Section9Key 2 - o. vrre lJ(JssrL)re soluLaorl apPears...

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: o. vrre lJ(JssrL)re soluLaorl apPears DeIow. ^ rur l r tr 4 i\ v I/ void writechars (int n) { if elqe (n throw if uJrusrrt ";."-; /n new I llegaJ-ArgumentExcept 1) ^r1f --int 1r*r\. ,f ion ( ) ; (n :: 2l else if System. out .print ol qo I t Q ru . J yr o q lE r r ro. m u u . un! rf r l v nri n. r rl L ( " * * r r) ; / t l < t- l \ \ , . t (n writechars System. out.print ) ) 7. One possibl,e public i-f solution 2l; (">") ; appears befow. n) { void printTwos (int (n throw new IllegalArgumentException (n \ 4 0) { else if * System.out.print("2 ") ; printTwos (n / 4l; System. out . print. ( " "' 2tt) i (n * 2::0) t ) else if ("2 * ") ; System.out.print printTwos (n / 2\ i i et-se { (n) ; System. out.print ) sofution appears bel-ow. s) { () ; ) 8. One possibl-e public if (Stack<Integer> void stutter (!s.isEmPtYO) t int next s.pop ( ) ; (s); stutter s.push (next) ; s.push (next) ; ) i 9. One possibl-e public if solutj-on appears bel-ow. n, int m) { void countToBy(int (m <:0 n <= 0) ll throw new IllegalArgumentExcePtion (n (: fi) else if (n) i System. out.print else { m, m) ; countToBy (n il + n); System.out.Print(", ) O; ) ...
View Full Document

This note was uploaded on 11/03/2009 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