Recursion 1 (ch. 12)

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

Why do we need to learn Recursion?

"cultural experience" -A different way of thinking of problems Can solve some kinds of problems better than iteration Leads to elegant, simplistic, short code (when used well) Many programming languages ("functional" languages such as Scheme, ML, and Haskell) use recursion exclusively (no loops)

What is recursive case?

A more complex occurrence of the problem that cannot be directly answered, but can instead be described in terms of smaller occurrences of the same problem.

What is base case?

A simple occurrence that can be answered directly.

What are characteristics of recursive programming?

An equally powerful substitute for iteration(loops) Particularly well-suited to solving certain types of problems

Recursion is primarily used in two ways.....

Designing recursive data structures. Implementing recursive methods.

What is recursion?

The definition of an operation in terms of itself.

What is recursive programming?

Writing methods that call themselves to solve problems recursively.

What are Pros cons of recursion?

any iterative solution can also be done recursively and vice versa. Recursive solutions may be difficult to conceptualize. Recursive solutions can involve much less code. Recursive brevity and elegance comes at a price. Some solutions are more suited for recursion.

Every recursive algorithm/method involves at least 2 cases:...

base case recursive case

Some recursive algorithms have ...base or recursive case, but all have at least...

more than one one of each.

Solving a problem using recursion depends on ...

solving smaller occurrences of the same problem.


Ensembles d'études connexes

Volume 5 Chapter 13 Hazardous Materials Haz Mat

View Set

NU373 Week 3 EAQ Evolve Elsevier: Oxygenation (Asthma, COPD, RSV)

View Set

IELTS Speaking Questions and Answers Set 1_Accomodation

View Set

NC Today's Hunter Study Questions (Set 2)

View Set