Assignment 10 - NPC - Updated

Assignment 10 - NPC - Updated - The Hong Kong University of...

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

View Full Document Right Arrow Icon
COMP 271: Design and Analysis of Algorithms Fall 2007 Assignment 10 Assigned: 29/11/07 Due Date: 6pm, 7/12/07 Question 1 : Let m and n be two positive integers. Consider the following brute-force algorithm for Fnding 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
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online