PYTHON (DATA STRUCTURES) Recursion: 1. A recursive function must have at least o
ID: 3596417 • Letter: P
Question
PYTHON (DATA STRUCTURES)
Recursion: 1. A recursive function must have at least one base case. 2. In a recursive function, there is at least one statement that calls the recursive function itself 3. Each recursive call should be defined so that it makes progress towards a base case Binary Recursion: 1. A binary recursion has two recursive calls included in the implementation. 2. A binary recursion could have one or more base cases. 3. A binary recursion has two recursive calls been executed in non-base cases. 4. A binary recursion has exactly two base cases Linear Recursion 1. A linear recursion should have one and only one statement to call itself. 2. A linear recursion could have multiple statements call itself and more than one of these statements be executed. 3. A linear recursion has a base case. 4. A linear recursion could have multiple statements call itself, but only one of these statements will be called. 1. A tail recursion makes recursive calls as its last step 2. There should be no statement after a recursive call. 3. The BinarySum function(a function that adds all the numbers in an integer array using Binary recursion) is not a tail recursion. 4. A tail recursion must be a linear recursion 5. A tail recursion doesn't have to be a linear recursionExplanation / Answer
Recursion:
Ans: 1 , 2, 3
Binary Recurion:
Ans: 2, 3
1 is false because it can be any number of recursive calls in implementation
but only two will be called
4 is false because base case can be in any number.
linear Recursive:
ANs: 3, 4
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.