Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QuickSort and MergeSort are both recursive algorithms, which means that: They mu

ID: 3733723 • Letter: Q

Question

QuickSort and MergeSort are both recursive algorithms, which means that: They must have a base case. O They can only work on Objects, not primitive types O They are never going to be worse than O(N2) O They don't have to use comparisons in order to do sorting. Question 3 1 pts The Merge Sort works by partitioning array so that the smaller are on the left and the larger are on the right. Then, it recursively sends small parts of larger arrays to itself and partitions again. Then continues until all the items in the array are sorted. O True O False

Explanation / Answer

1.Ans) They must have a base case

A recursive function definition has one or more base cases, meaning input(s) for which the function produces a result trivially (without recurring)

2 Ans)True

Merge sort is a recursive algorithm that continually splits a list in half. If the list is empty or has one item, it is sorted by definition (the base case). If the list has more than one item, we split the list and recursively invoke a merge sort on both halves. Once the two halves are sorted, the fundamental operation, called a merge, is performed. Merging is the process of taking two smaller sorted lists and combining them together into a single, sorted, new list