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 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
This is the end of the preview. Sign up
access the rest of the document.
This note was uploaded on 10/18/2009 for the course COMP 271 taught by Professor Arya during the Spring '07 term at HKUST.