

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Class: Algorithm Design and Analysis; Subject: Computer/Information Sciences; University: University of Delaware; Term: Unknown 1989;
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


H/W H: Partition Model Answer
๎ n ๎ 1 ๎ โ 1 ๎ ๎ 2 โ 1 ๎
๎ n ๎ 1 ๎ โ 1 ๎= O ๎ 2 n ๎
2.The above worst case of O(2n) was obtained by assuming the binary tree that we get is complete and has a depth of n. To prove that the worst case has a lower bound of 2n (that is, the worst case is ฮฉ(2n)) we have to find a sequence of n elements that result in a recurrence tree that is a complete binary tree with a depth of n. To get such a recurrence tree, assume a data set 2, 4, 8,... 2n. In this data set, the last term is greater than the sum of all the previous terms. For this data set, the test if (T < *b) will be false for all but the last element of the data set. Hence, in each case other than the last element, we will get two calls to SubsetSum and hence we will obtain a recurrence tree which is a complete binary tree of depth n. Thus, by the recurrence tree shown above, we get: T(n) = ฮฉ( 2n^ ) 3.We may do slightly better in the average case by performing a number of checks: 1.If a single element is greater than the sum of half the elements, return false. 2.Perform a check for T โค 0, if true, return false. However, we cannot do much better in the worst case as this problem has a run time of ฮ( 2n^ ) and hence belongs to a class of NP complete problems and till date no one has been able to prove that NP = P. ฮ(n) ฮ(n) ฮ(n) ฮ(n) ฮ(n) ฮ(n) ฮ(n) T(0) T(0) T(0) T(0)
2 n