Category: A2

FIT 1008/2085 A2

48 Posts

Consider the following example Python function
Explain what is the purpose of this function. What is the base case for this function? Is it tail-recursive? What is the output of this function for arr = [1, 2, 3, 4, 5, 6, 7, 8] How does the function recurse and how does the return value change in each call? Write an equivalent iterative version of this function. What is the best- and worst-case time complexity of the recursive function? Give a one-line scenario for each complexity with the variables defined.
Consider the following example Python function(2)
Explain what is the purpose of this function What is the base case for this function? Is it tail-recursive? What is the output of this function for arr = [1, 2, 3, 4, 5, 6, 7, 8] How does the function recurse and how does the return value change in each call? Write an equivalent iterative version of this function. What is the best- and worst-case time complexity of the recursive function? Give a one-line scenario for each complexity with the variables defined.
Consider the following example Python function(3)
Explain what is the purpose of this function What is the base case for this function? Is it tail-recursive? What is the output of this function for n = 3 How does the function recurse and how does the return value change in each call? Write an equivalent iterative version of this function. What is the best- and worst case time complexity of the recursive function? Give a one line scenario for each complexities with the variables defined.