- 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.
No Comments