Question: Although merge sort runs in Theta (nlgn) worst-case time and insertion sort runs in Theta(n^2) worst-case time, the constant factors in insertion sort make it

 Although merge sort runs in Theta (nlgn) worst-case time and insertion

Although merge sort runs in Theta (nlgn) worst-case time and insertion sort runs in Theta(n^2) worst-case time, the constant factors in insertion sort make it faster for small n. Thus, it makes sense to use insertion sort within merge sort when subproblems become sufficiently small. Consider a modification to merge sort in which n/k sublists of length k are sorted using insertion sort and then merged using the standard merging mechanism, where k is a value to be determined. a) Show that the n/k sublists, each of length k, can be sorted by insertion sort in Theta(n/k) worst-case time. b) Show that the sublists can be merged in Theta (nlg(n/k)) worst-case time. c) How should k be chosen in practice? Let f(n) and g(n) be asymptotically nonnegative functions. Using the basic definition of Theta - notation, prove that max (f(n), g(n)) = Theta(f(n) + g(n)). Is 2^n + 1 = 0 (2^n)? Is 2^2n = 0(2^n)? Why, please provide detailed reasoning

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!