Assignment 10 - NPC

# Assignment 10 - NPC - The Hong Kong University of Science...

This preview shows page 1. Sign up to view the full content.

The Hong Kong University of Science & Technology COMP 271: Design and Analysis of Algorithms Fall 2007 Assignment 10 Assigned: 29/11/07 Due Date: 6pm, 7/12/09 Question 1 : Let m and n be two positive integers. Consider the following brute-force algorithm for finding the greatest common divider of m and n : GCD( m,n ) let r = 1. for ( k = 1; k < min ( m,n ); k ++ ) if k divides both m and n , r = k . return r . Give a measure for the size of the input to GCD and argue why it is reasonable. And analyze the complexity of GCD in terms of the input size. (You can assume that m n am b for some positive constants a and b .) Question 2 Show that the Subset Sum ( SS ) problem is NP-complete. You may use the fact that the Set Partition (
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern