Back to marketplace

Recursion

No description yet. This curated deck is ready for daily study.

Total cards: 10•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (10)

#1
Front (Question)

what is recursion

Back (Answer)

when a function calls itself this produces repetition

#2
Front (Question)

when is recursion used

Back (Answer)

to make code repeat as an alternative to iteration

#3
Front (Question)

what are the advantages and limitations of recursion

Back (Answer)

+ shorter and simpler code • each recursion uses up space in memory

#4
Front (Question)

structure of a recursive function

Back (Answer)

• header w/ name of func and parameters • base case - an if statement, ends as the final return • the name of the function itself with any other parameters

#5
Front (Question)

the base case

Back (Answer)

an if statement typically at the top of a recursive function defenition if the test is true , the recursion stops

#6
Front (Question)

how are parameters used in recursuon

Back (Answer)

pass values along the chain of functions that open in memory

#7
Front (Question)

how to convert a recursive function to iteration

Back (Answer)

• turn the if line of the base case into the header of a while loop, reversing the logic • indent the commands inside the while loop • delete recursive lines

#8
Front (Question)

how to convert an iterative function to recursion

Back (Answer)

• convert the header of the while loop into a base case (if statement) , reversing the logic add a recursive line at the end of the program consider whether you need to use parameters

#9
Front (Question)

similarity between recursion and iteration

Back (Answer)

used to repeat blocks of code

#10
Front (Question)

differences between recursion and iteration

Back (Answer)

recursive function often solves a problem in fewer lines of code, but uses more memory iterative function overrwrites same area of memory repeatedly, using less space iterative functions use more lines to solve the problem