Deck 7: Recursive Algorithms
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 7: Recursive Algorithms
1
Ferns have a recursive structure.
True
2
The following short story is considered to be recursive:
Once upon a time a young princess was sitting with her father, the king. She said to her father, "My Royal Father, can you read me a story?"
Yes, my Royal Daughter," said the king, as he opened the Royal Storybook. He began to read, "Once upon a time a young princess was sitting with her father, the king. She said to her father, 'My Royal Father, can you read me a story?'"
"Yes, my Royal Daughter," said the king, as he opened the Royal Storybook. He began to read, "Once upon a time a young princess was sitting with her father, the king. She said to her father, 'My Royal Father, can you read me a story?' . . ."
Once upon a time a young princess was sitting with her father, the king. She said to her father, "My Royal Father, can you read me a story?"
Yes, my Royal Daughter," said the king, as he opened the Royal Storybook. He began to read, "Once upon a time a young princess was sitting with her father, the king. She said to her father, 'My Royal Father, can you read me a story?'"
"Yes, my Royal Daughter," said the king, as he opened the Royal Storybook. He began to read, "Once upon a time a young princess was sitting with her father, the king. She said to her father, 'My Royal Father, can you read me a story?' . . ."
True
3
The marble floor of the Sistine Chapel has patterns in the tiles that is an example of a mathematical design called a Sierpinski gasket.
True
4
The Sierpinski gasket algorithm splits the triangle into four smaller triangles, and then calls itself for three of the four smaller triangles.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
The power of recursion in computer programming is the way in which computer scientists use recursive algorithms to analyze and solve complex problems.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
An object is really just a set of instructions describing how to complete a process.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
Recursion can describe a very sophisticated process with a simple and efficient set of instructions.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
There is some evidence that the human brain is recursive.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
Blood vessels in the human body have a structure that can be best described by recursion.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
The pattern of seeds on the head of a sunflower, the geometry of a snail's shell, and even DNA gene sequencing all appear to be recursive structures.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
Seemingly random events, such as an electronic interference in a telephone circuit, can be described using recursive functions.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
An understanding of recursion is essential to programming any algorithm.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
Many of the most important algorithms in computing - such as those used to search large databases quickly - depend on the use of recursion.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
Often it is better to use recursion instead of iteration for methods that can be written using a simple loop.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
The computer must set up a section in its memory every time a new method is called - except when the new method is a copy of an existing method.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
A method that uses linear recursion can very quickly generate many copies of itself to work simultaneously on smaller examples of the overall problem.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
Generally, a method that uses exponential recursion is often very easy to replace with a more efficient iterative solution.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
Exponentially recursive algorithms are often far more efficient than iterative solutions because they can repeatedly break a problem into several smaller parts and then attack those smaller parts in a way that an iterative algorithm cannot.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
Even after taking into account the overhead, iterative algorithms are usually far more efficient than recursive solutions.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
For simple tasks that can be described with linear recursion, iteration seems to be a better choice.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
For complex problems that can be broken down into smaller parts, linear recursion usually works much better.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
On a computer, conditional recursion continues until all available memory is used, or until it triggers some time-out mechanism in the operating system.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
A properly structured recursive algorithm should always contain a Boolean expression in a selection sequence.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
In conditional exponentially recursive algorithms, the recursive step breaks the problem into smaller parts, and then calls the algorithm itself for each of those parts, continuing to do so until the base case is reached.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
After reading the specifications for a project, a good programmer should put together a set of questions for the person who provided the specifications.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
In computer programming, an algorithm that calls itself is said to be ____.
A) iterative
B) recursive
C) cyclic
D) repetitive
A) iterative
B) recursive
C) cyclic
D) repetitive
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
A(n) ____ is one that uses a loop to repeat a set of instructions.
A) cyclic process
B) iterative process
C) repetitive process
D) recursive process
A) cyclic process
B) iterative process
C) repetitive process
D) recursive process
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
The term ____ is just another name for looping.
A) iteration
B) recursion
C) encapsulation
D) orientation
A) iteration
B) recursion
C) encapsulation
D) orientation
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
The term ____ is used to describe the processor time and storage space in a computer's memory needed to manage a method as it runs.
A) outlay
B) cost
C) price
D) overhead
A) outlay
B) cost
C) price
D) overhead
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
____ occurs when a method calls itself only once each time through the method.
A) Linear recursion
B) Infinite recursion
C) Exponential recursion
D) Mutual recursion
A) Linear recursion
B) Infinite recursion
C) Exponential recursion
D) Mutual recursion
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
The recursive Sierpinski gasket algorithm is an example of ____ because it calls itself three times.
A) linear recursion
B) mutual recursion
C) exponential recursion
D) iteration
A) linear recursion
B) mutual recursion
C) exponential recursion
D) iteration
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
A linear recursion graph looks like a ____.
A) parabola
B) straight line
C) ellipse
D) circle
A) parabola
B) straight line
C) ellipse
D) circle
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
An exponential recursion graph looks like a ____.
A) polygon
B) straight line
C) circle
D) curve
A) polygon
B) straight line
C) circle
D) curve
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
At each level of exponential recursion, the number of copies of the program ____.
A) doubles
B) triples
C) quadruples
D) quintuples
A) doubles
B) triples
C) quadruples
D) quintuples
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
The following algorithm is an example of ____.
Begin with an equilateral triangle
Sierpinski (triangle)
Start
Find the midpoint of each side of the triangle
Draw lines connecting the midpoints, which will form four smaller triangles that can be called triangles A, B, C, and D, with D in the center and the others around it.
Color in (or cut out) the center triangle // triangle D
Do Sierpinski (triangle A)
Do Sierpinski (triangle B)
Do Sierpinski (triangle C)
Stop
A) linear recursion
B) iteration
C) mutual recursion
D) infinite recursion
Begin with an equilateral triangle
Sierpinski (triangle)
Start
Find the midpoint of each side of the triangle
Draw lines connecting the midpoints, which will form four smaller triangles that can be called triangles A, B, C, and D, with D in the center and the others around it.
Color in (or cut out) the center triangle // triangle D
Do Sierpinski (triangle A)
Do Sierpinski (triangle B)
Do Sierpinski (triangle C)
Stop
A) linear recursion
B) iteration
C) mutual recursion
D) infinite recursion
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
____ occurs when a method calls itself more than once in each pass through a method.
A) Linear recursion
B) Iteration
C) Exponential recursion
D) Tail recursion
A) Linear recursion
B) Iteration
C) Exponential recursion
D) Tail recursion
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
The term ____ implies that an algorithm calls itself repeatedly without stopping.
A) tail recursion
B) iteration
C) linear recursion
D) infinite recursion
A) tail recursion
B) iteration
C) linear recursion
D) infinite recursion
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
____ occurs when an algorithm does not contain any instructions about when to stop the recursion.
A) Tail recursion
B) Iteration
C) Binary recursion
D) Infinite recursion
A) Tail recursion
B) Iteration
C) Binary recursion
D) Infinite recursion
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
Recursion that is not infinite is called ____.
A) mutual recursion
B) conditional recursion
C) binary recursion
D) iteration
A) mutual recursion
B) conditional recursion
C) binary recursion
D) iteration
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
The condition that stops the recursion is called the ____.
A) end condition
B) stop order
C) end case
D) base condition
A) end condition
B) stop order
C) end case
D) base condition
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
A recursive algorithm usually contains a(n) ____ instruction that causes the algorithm to keep calling itself until the base condition is met.
A) For
B) Stop
C) IF/ELSE
D) Start
A) For
B) Stop
C) IF/ELSE
D) Start
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
In Alice, clicking on the ____ button allows you to enter Scene Editor mode.
A) Add instance to world
B) Done
C) Open
D) ADD OBJECTS
A) Add instance to world
B) Done
C) Open
D) ADD OBJECTS
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
In Alice, the ____ button can be used if you are unhappy with one of your moves.
A) Add instance to world
B) Undo
C) create new method
D) ADD OBJECTS
A) Add instance to world
B) Undo
C) create new method
D) ADD OBJECTS
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
The pseudocode for a recursive method is shown below. What statement is missing from the area labeled (a)?
Biplane.taxi (target)
(a)
If ( [biplane.distance to target] > 1 meter)
{
Biplane.point at target
Biplane.move forward 1 meter
(b)
}
(c)
A) Start
B) Do together
C) biplane.taxi (target)
D) Stop
Biplane.taxi (target)
(a)
If ( [biplane.distance to target] > 1 meter)
{
Biplane.point at target
Biplane.move forward 1 meter
(b)
}
(c)
A) Start
B) Do together
C) biplane.taxi (target)
D) Stop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
The pseudocode for a recursive method is shown below. What statement is missing from the area labeled (b)?
Biplane.taxi (target)
(a)
If ( [biplane.distance to target] > 1 meter)
{
Biplane.point at target
Biplane.move forward 1 meter
(b)
}
(c)
A) Start
B) Do together
C) biplane.taxi (target)
D) Stop
Biplane.taxi (target)
(a)
If ( [biplane.distance to target] > 1 meter)
{
Biplane.point at target
Biplane.move forward 1 meter
(b)
}
(c)
A) Start
B) Do together
C) biplane.taxi (target)
D) Stop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
The pseudocode for an iterative method is shown below. What statement is missing from the area labeled (a)?
Sailboat.sail to (target)
(a) ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
}
(b)
A) For
B) If
C) While
D) Stop
Sailboat.sail to (target)
(a) ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
}
(b)
A) For
B) If
C) While
D) Stop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
The pseudocode for an iterative method is shown below. What statement is missing from the area labeled (b)?
Sailboat.sail to (target)
(a) ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
}
(b)
A) For
B) If
C) While
D) Stop
Sailboat.sail to (target)
(a) ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
}
(b)
A) For
B) If
C) While
D) Stop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
The pseudocode for a recursive method is shown below. What statement is missing from the area labeled (a)?
Sailboat.sail to (target)
(a)
If ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
(b)
}
(c)
A) sailboat.sail to (target)
B) Start
C) Do together
D) Stop
Sailboat.sail to (target)
(a)
If ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
(b)
}
(c)
A) sailboat.sail to (target)
B) Start
C) Do together
D) Stop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The pseudocode for a recursive method is shown below. What statement is missing from the area labeled (b)?
Sailboat.sail to (target)
(a)
If ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
(b)
}
(c)
A) sailboat.sail to (target)
B) Start
C) Do together
D) Stop
Sailboat.sail to (target)
(a)
If ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
(b)
}
(c)
A) sailboat.sail to (target)
B) Start
C) Do together
D) Stop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
The pseudocode for a recursive method is shown below. What statement is missing from the area labeled (c)?
Sailboat.sail to (target)
(a)
If ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
(b)
}
(c)
A) sailboat.sail to (target)
B) Start
C) Do together
D) Stop
Sailboat.sail to (target)
(a)
If ( not [sailboat is within 5 meters of target] )
{
Do together
{
Sailboat.turn to face target
Sailboat.move forward 2 meters
}
(b)
}
(c)
A) sailboat.sail to (target)
B) Start
C) Do together
D) Stop
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck