Module 9: Recursion and Fractals Flashcards
_________ is any thing that refers to itself.
recursion
A ________ is a thing that has self-similar copies of itself in itself.
fractal
The drawing tool used to draw fractals is _________.
ipycanvas
A __________ is a square fractal that is divided into 9 smaller squares: the middle is simply filled in and each of the outer squares is a smaller ___________ of depth one less.
sierpinski carpet
sierpinski carpet
A node with ________ is a leaf.
no children
A ________ stores some information on each node.
label
A __________ is a special kind of tree that only has labels on the leaves. If no label, a node is storing only a list of _________.
leaf-labelled tree
more trees
Define an LLT as ____________.
LLT = int | list[‘LLT’]
Need to treat differently the different ‘kinds’ of LLT. Write int kind as ____________. Write list kind as _____________.
if isinstance(t, int): …
if isinstance(t, list): …
To rewrite code using while so it uses recursion instead:
1. add a ___________ for each local variable; set initial value in call.
2. replace the while with ______.
3. return the value from a recursive call with ________________.
4. in the else, return the answer based on the __________.
parameter
if
updated parameters
parameter values
A _______ function is a function that does some small setup before calling another function that does the main work.
wrapper