CSE331 Homework 3 (Jan. 29 Update)Due: Friday Feb. 1, 2008 at 11:59am1.Show how the quick-sort algorithm (page 286, but let the quick-sort work all the way to size 1 and 0 rather than calling insertion sort) sorts the following list:Index: 0 1 2 3 4 5 6 7 8Key: 414 132 327 554 877 542 433 986 233Draw the calling diagram as a tree, where each node corresponds to a quick-sort call. The root is the original call. In each node:a.Provide the A array right after the pivot is restored.b.Give the parameters of every call, including the content of the A array, left and right parameters. The order of the numbers in A array needs to be correct.2.(Problem 7.32 (a-c) on page 309.) Suppose you are given a sorted list of N elements, followed by f(N) randomly ordered elements. How would you sort the entire list if (a) f(N) = O(1) ? (b) f(N) = O(log N) ? (c) f(N) = O( sqrt (N) ) ?Describe your algorithm in detail for each size N. Try to keep the running time of your algorithm as efficient as possible. Additionally, provide the complexity (in terms of big O) of each of your algorithms.
This is the end of the preview.
access the rest of the document.