Question 1 (20 points) Design a divide and conquer algorithm that returns the height of an input binary
tree with ? nodes. Analyze the running time of the algorithm.
Question 2 (20 points) Design a divide and conquer algorithm that returns a pair (x, y), where x is the
largest number and y is the second largest number in an array of n numbers. Analyze the running time of
the algorithm.
Question 3 (15 points) Consider the following modification of the algorithm Merge Sort. The
algorithm first divides the input array A[low..high] into four parts A1,A2,A3, and A4 instead of two. It
then sorts each part recursively, and finally merges the four sorted parts to obtain the original array
in sorted order. Assume for simplicity that n is a power of 4. Analyze the modified Merge Sort
algorithm running time.
Question 4 (20 points; 10 points; 10 points) Find the time complexity of the Select algorithm if it
divides the array A into q groups of:
a) 4 elements.
b) 7 elements.
Question 5 (15 points) Apply the Quick Sort algorithm on the array
A = [32, 65, 40, 11, 18, 29, 37, 32, 53]
Clearly show the pivot and the subarray contents after the split terminates.
Question 6 (10 points) What is the running time of Quick Sort algorithm when all elements of array
A have the same value?
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more
Recent Comments