tutorial06

# tutorial06 - CS 135 Winter 2012 Tutorial the Sixth CS 135...

This preview shows pages 1–6. Sign up to view the full content.

CS 135 - Winter 2012 Tutorial the Sixth February 15, 2012 CS 135 Winter 2012 06: Tutorial the Sixth 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Clicker Question - type of recursion ( define ( foo a b ) ( cond [( zero? a ) b ] [ else ( foo ( sub1 a ) ( cons " foo " b ))])) ( foo 19 empty ) What kind of function is this? A Pure structural recursion B Structural recursion with an accumulator C Generative recursion D Non-recursive E Recursion of another type CS 135 Winter 2012 06: Tutorial the Sixth 2
Clicker Question - Recursion What type of recursion is used in the following function? ( define ( fn1 a ) ( fn2 a 1 0 )) ( define ( fn2 a b c ) ( cond [( zero? a ) c ] [ else ( fn2 ( sub1 a ) b ( + b c ))])) A Pure Structural Recursion B Accumulative Recursion C Generative Recursion CS 135 Winter 2012 06: Tutorial the Sixth 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Clicker Question - Recursion What type of recursion is used in the following function? ( define ( fn3 a ) ( cond [( = 1 a ) ( cons 1 empty )] [( even? a ) ( cons a ( fn3 ( / a 2 )))] [ else ( cons a ( fn3 ( + 1 ( * 3 a ))))])) A Pure Structural Recursion B Accumulative Recursion C Generative Recursion CS 135 Winter 2012 06: Tutorial the Sixth 4
Clicker Question - Recursion What type of recursion is used in the following function?

This preview has intentionally blurred sections. Sign up to view the full version.

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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern