S6-P3 Flashcards
166 related:
When the array is already sorted, the ____ sorting algorithm is the best speed wise, and is of Order ____. The original sorting order and the desired sorting order (inc/dec) must be the same/doesn’t matter .
Insertion, O(n), same
*
1
A
Note On Quick Sort (qs) Recursive Function: We use median as pivot for the best complexity order, when we find the median ( θ(n) ), we create the recursive tree, each side has n/2 numbers that the same process happens to them.
Reminder: Order of partition based on an element in an array is θ(n), because we’re finding the kth element in an array.
168 related:
What’s the order of sorting K sorted list, each having n/k members?
O(All the elements (n) x log number of sorted lists (K))=O(n x logk)
End Of P3