(Recursive)
Self-Referencing Drawing
Tree
This
figure begins as a vertical segment one unit in length. The recursive procedure
is to create two new segments at the end of each previously drawn segment. Each
new segment is half as long as the previously drawn segment(s)
and is rotated 135 degrees clockwise and counter clockwise respectively.
The
pseudocode:
void DrawTree ()
Draw a trunk
Draw a
smaller tree 135 degrees clockwise
Draw a
smaller tree 135 degrees counter clockwise
Questions
1. Where does the recursion appear in this pseudocode?
2. Which branch is always drawn first? Why?
3. This pseudocode runs infinitely. Why?

Sierpinski
Triangle
The pseudocode:
void SierTriangle (an equilaterial triangle)
If the triangle is too small, stop
Else
Connect the midpoints of the sides with line segments
Colour the middle triangle a different colour
SierTriangle(top triangle)
SierTriangle(bottom left triangle)
SierTriangle(bottom right triangle)
Questions:
1. If we changed the order of the last three function calls, what effect would it have on the order that the picture was drawn?
2. If we changed the order of the last three function calls, what effect would it have on the final picture?
3. Will this pseudocode run infinitely? Why or why not?
Recursive Drawing Assignment:
Write your own pseudocode for a recursive drawing. Make sure if has a base case and a recursive case.
Draw
at least three generations of your drawing.
On-line Sites With Ideas:
·
Sierpinski Triangle:
Lanius, Cynthia. Making a Fractal: The Sierpinski Triangle.
June 14, 2002. <htttp://math.rice.edu/~lanius/fractals/sierjava.html>