Computer Science 15-112, Fall 2011
Class Notes: Practice (through week 10 (recursioni))
External resources
Recursive problems @ codingbat
See
recursion-1 and
recursion-2. These are spec'ed for Java, but are easily
translated to Python problems.
Sparknotes recursion review
See
here.
Google search
There are many, many other online resources for
recursion practice problems.
Recursive isPalindrome
A sequence (string or list or tuple) is a palindrome if its first and last
elements match, and if the rest of the sequence is also a palindrome.
Recursive bullseye
Draw a bullseye noting that a bullseye is simply a circle with a smaller
bullseye inside it.
Recursive Fractal Sun
Draw this:
Note that a fractal sun is composed of a circle of radius r, and 8 rays of
length 2*r originating from the center of the circle and radially equally
spaced. The external tip of each ray is also the origin of a recursively
downsized fractal sun with radius equal to 1/4 of the radius of the sun at
the previous level.
Recursive
Turtle Spiral
Draw this:
Your function will take two parameters, size and minSize. The longest side
has length equal to size, and each following side is 10% shorter than the
previous one. The length of the shortest side is no shorter than minSize.
carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem