Question: uestion 2 (Total 20 marks): Sorting and Recursion a) (3 marks). If you had to use a sorting algorithm in a low memory environment, what

uestion 2 (Total 20 marks): Sorting and Recursion a) (3 marks). If you had to use a sorting algorithm in a low memory environment, what would be the most important factor to consider? Would a mergesort be an appropriate choice? Justify your answer. b) (5 marks). Do you agree with the statement: The best pivot to select for a quicksort is the median of all the values."? Justify your answer with reference to Big O time complexity. c) (3 marks). Divide and Conquer style sorting algorithms like quicksort and mergesort can be done recursively. What kind of problems could occur when recursively sorting very large datasets? Can this be mitigated, or should a different algorithm be used? d) (5 marks). Rewrite the following recursive algorithm as an iterative one
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
