返回卡包市场

2.2.1 programming techniques

暂无描述。系统推荐的高质量记忆内容,适合每天坚持背诵学习。

卡片总数: 7内容版本: v4公开卡包更新时间: 8/1/2026

卡片预览 (7 张)

#1
正面 (问题)

what is recursion?

背面 (解答)

a function that calls on itself it has a terminating/base case it also has a general case

#2
正面 (问题)

how do you convert a recursive algorithm to an iterative algorithm?

背面 (解答)

• the opposite of the base case is used for the while loop condition • the parameters in the recursive calls of the function are set as changing the variables

#3
正面 (问题)

what are the advantages of recursive algorithms?

背面 (解答)

• uses less lines of code • well suited to certain problems/elegant solution

#4
正面 (问题)

what are some disadvantages of recursive algorithms?

背面 (解答)

• risk of stack overflow • uses more memory

#5
正面 (问题)

how can you trace through a recursive algorithm?

背面 (解答)

• use a table (if provided) and write each function call, the value of the parameters and the return • write each line of code and write the decisions (true/false) next to it. Then do this for the next call of the function with the correct values. finally, write the return values of each instance of the function call

#6
正面 (问题)

What are some examples of recursive algorithms?

背面 (解答)

• merge sort • binary tree search • calculating factorials

#7
正面 (问题)

背面 (解答)