Recursion

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Which of the following problems can be programmed recursively?

- towers of hanoi - summing a range of array elements - finding the greatest common divisor

The Towers of Hanoi is

-a mathematical game -often used in computer science textbooks -demonstrates the power of recursion

A problem can be solved recursively if it can be broken down into successive smaller problems that are unique within the overall problem.

False

A recursive method is a method that

calls itself

The number of times that a method calls itself is known as the

depth of recursion

Like _________, a recursive method must have some way to control the number of times it repeats.

loop

A problem can be solved recursively if it can be broken down into successive smaller problems that are identical to the overall problem.

True

Any problem that can be solved recursively can also be solved iteratively.

True

If Method A calls Method B which in turn calls Method A, it is called indirect recursion.

True

Indirect recursion occurs when a method calls another method that in turn calls the first method.

True

Recursive algorithms are usually less efficient than iterative algorithms.

True

The actions that the JVM must perform any time a method is called is called

overhead

Like a loop, a recursive method must have

some way to control the number of times it repeats itself.

To solve a program recursively, you need to identify at least one case in which the problem can be solved without recursion - this is known as

the base case

The depth of recursion is

the number of times that a method calls itself


संबंधित स्टडी सेट्स

Retirement Accounts (IRA'S, 401k's, 403b's)

View Set

English, Mrs. Owsley - 1st Qtr, Mid-term

View Set

<2> 生活・金融機関 漢字リスト

View Set

Chapter 1: The Comparative Approach

View Set

Crash Course Economics Episode 5

View Set

Drivers Ed Test 10 - Driving Environments

View Set