Note: If you want to leave comment as Anonymous, don't type name and email when you leave comments
Post your answers
What are the differences between them? Compare the stability of QuickSort and MergeSort and discuss which one would be a better choice in a scenario where stability is important.
How it sorts a given array? What is the best and worst case the time complexity of MergeSort and explain why? No explanation no marks. In which scenario would MergeSort be a good choice of sorting algorithm and explain why
How does it sort a given array? What is the best and worst case the time complexity of QuickSort and explain why? No explanation no marks. Does the choice of the pivot matter in a QuickSort algorithm why/why not?
The basic idea behind recursive sorting algorithms How they divide the original problem? How they combine the results. Give an example of a recursive sorting algorithm and explain how it works.
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.
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.
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.
Finally, if the provided function is not tail recursive, explain how it could be modified to use tail recursion. If tail recursive, explain what makes it tail recursive.
Provide at least one advantage and disadvantage of using recursion compared to iteration, Provide examples to support your points.