Recursion

Ace your homework & exams now with Quizwiz!

What is Recursion?

* A problem solving concept which can be used with languages that support the dynamic allocation of memory. * In programming, it is the ability for a function to call itself! * The concept has it's foundation in mathematics.

Advantage/Disadvantage of Recursion

* ADVANTAGE Usually a more concise coding solution, some solutions are more easily implemented using recursion * DISADVANTAGE Less efficient due to overhead involved with function calls.

A Walkthru of Recursive Code

* Run Time Stack * Winding and Unwinding the stack * Local variables, parameters, return values stored on the stack

Two Requirements for Recursive Code

* There must be an anchor point. (Sometimes this is called the base case.) * Each recursive call must approach the anchor point (or base case).


Related study sets

The Electron Transport Chain and Oxidative Phosphorylation

View Set

Chapter 17: Dry Regions: The Geology of Deserts

View Set

NUR 3420 Pharmacology PrepU Ch20

View Set

Chapter 17 - Preoperative Nursing Management

View Set