tutorial06

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

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 135 - Winter 2012 Tutorial the Sixth February 15, 2012 CS 135 Winter 2012 06: Tutorial the Sixth 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

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

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online