Ch 3 recursion

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is recursion?

A programming technique in which a method calls itself.

T/F the call stack never gets very large

F

every recursive function has what two parts, describe them

base case and recursive case. the recursive case is when the function calls itself and the base case is when the function doesn't call itself so it does not enter an infinite loop

check that you can write a recursive function, try a factorial one

check!!!!

what is the cost of recursion and what are two fixes

it can take up alot of memory. rewrite the code to use loops or use tail recursion.

where do function calls go

onto the call stack

whate are the two operations of a stack

push and pop

what is the benefit of recursion

there is no benefit in using recursion, it is used when it makes the program clearer and you could get the same result from using loops


Kaugnay na mga set ng pag-aaral

Emergency Nursing Orientation 3.0: Behavioral Health Emergencies

View Set

comm 10 final pt 7: ethics in mass media

View Set

Texas Promulgated Contract Forms

View Set

mICROSCOPIC IDENTIFICATION OF MAJOR PATHOGENS

View Set

A beautiful mind video- mental health

View Set

Chapters 6 & 7 - Review Questions

View Set

Serum Tumor Markers (and Psammoma bodies)

View Set

Chapter 14: Psychological Disorders

View Set