• 6

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 2 out of 6 pages.

(Total: 100 points)1.Let X(1..n) and Y(1..n) contain two lists of n integers, each sorted in nondecreasingorder. Give the best (worst-case complexity) algorithm that you can think for finding(a)the largest integer of all 2n combined elements.(b)the second largest integer of all 2n combined elements.
(c)the median (or the nthsmallest integer) of all 2n combined elements.
For instance, X = (4, 7, 8, 9, 12) and Y = (1, 2, 5, 9, 10), then median = 7, the nthsmallest,inthecombinedlist(1,2,4,5,7,8,9,9, 10, 12).[Hint: use the conceptsimilar to binary search]
2.1-to-2 PARTITION:Instance: A finite set of positive integersZ= {z1, z2, ... , znQuestion: Is there a subsetZ'ofZsuch thatSum of all numbers inZ'= 2*Sum of all numbers in(a)Obtain the dynamic programming functional equation to solve the 1-to-2PARTITIONproblem.}.Z-Z'
1

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 6 pages?

Course Hero member to access this document

Term
Fall
Professor
NoProfessor
Tags
Computational complexity theory, dk, NP complete