Data Structures

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

How does a recursive function know when to stop?

A recursive function must always include a test to determine if another recursive call should be made, or if the recursion should stop with this call.

What is a recursive function/algorithm?

A solution that is expressed in terms of (a) smaller instances of itself and (b) the base case.

What are the benefits and disadvantages to iteration?

Benefit - executes more efficiently. Disadvantage - harder to code or understand.

What are the benefits and disadvantages to recursion?

Benefit - solves problems in a simple and elegant way. Disadvantage - may not execute efficiently.

What are the types of recursion?

Direct - A function calls itself. Indirect - function A calls function B, and function B calls function A,.....

What is a run-time stack?

Each time a function is called, the computer system creates temporary storage for the parameters and the function's local variables.

What does recursive mean?

Having the characteristic of coming up again, or repeating.

What is the base case of a recursive function?

The case for which the solution can be stated non-recursively.

What is the general case for a recursive function?

The case for which the solution is expressed in terms of a smaller version of itself; also known as recursive case.

What is a "general case" in a recursive program?

The smallest version possible.

What are recursive functions used for?

To reduce a complex problem into a simpler-to-solve problem (base case).

What happens if there are no base cases?

You have an infinite recursion, the recursive equivalent of an infinite loop.


Ensembles d'études connexes

Fixed-Rate and Adjustable-Rate Mortgages

View Set

mobility practice questions prep

View Set

Quiz 1 Chapter 2 Characteristics of Real Property: Legal Aspects of Real Estate

View Set

Chapter 33. Nursing Care of Patients With Upper Gastrointestinal Disorders

View Set

EBF - Fagbegreber, Forkortelser, Fill in The Blank og Quiz

View Set

Security Program Administrative & Operational Services - Part 3

View Set

Excel Chapter 2, Excel Chapter 1

View Set

OAE 013 Early Childhood Special Education

View Set