# HW5ans

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ac c epts . 3. Otherwis e, rejec t.” Sinc e s tage1 and s tage2 both run in poly nomial time nondeterminis tic ally , NTM N c an dec ide the union of L1 and L2 in poly nomial time. Henc e, N P is c los ed under union. ii.) concatenation Without los s of generality , let N 1 and N 2 be the NTMs that dec ide two languages L1 and L2 in NP. Then we c ons truc t an NTM N that dec ides the c onc atenation of L1 and L2 in poly nomial time. N = ”on input w 1. For eac h pos s ible s plit of w = w1 w2 a. Run N 1 on w1 nondeterminis tic ally and run N 2 on w2 nondeterminis tic ally . Ac c ept if both ac c ept. 2. Otherwis e, rejec t.” As s ume the jwj = n . There are O(n) pos s ible s plits of w at mos t. Bes ides , the s um of the time c omplex ities of N 1 and N 2 is als o poly nomial. Thus , s tep1 run in poly nomial time and NTM N c an dec ide the c onc atenation of L1 and L2 in poly nomial time. Henc e, N P is c los ed under c onc atenation. 7.12 Sinc e ab is ex ponential in the length of b , we need to break down ab and apply the modulo operation s ev eral times s o that the res ulting s iz e nev er goes ex ponential. Firs t, we treat b in its binary repres entation. There are at mos t log2 b bits . So log2b log2b Q b 2i Q bi2 i ab mod p = ( a i ) mod p = ( (a mod p )) mod p i i In the wors t c as e, we as s ume bi = 1 for all i . Howev er, abi+12 mod p = (abi2 )2 mod p = (abi2 mod p )2 mod p : That is , eac h term c an be c omputed by s quaring the remainder of the prev ious term mod p . Henc e, for eac h modulo operation, the c omputation is O(p 2 ) whic h is in poly nomial time. Additionally , for eac h multiplic ation of neighboring terms , we als o apply the modulo operation in O(p 2 ): Sinc e there are at mos t log2 b terms , ab Ñ c (mod p ) is O(2 log2 b p 2 ): Therefore, M ODEX P 2 P : i+1 i i 7.16 1.) In the proof of theorem 7.56, the SUBSET­SUM problem ins tanc e c ons truc ted c ontains numbers of large magnitude pres ented in dec imal notation. Howev er, c ompared with binary /de...
View Full Document

## This note was uploaded on 10/26/2013 for the course CS 22C:135 taught by Professor Zhang during the Spring '13 term at University of Iowa.

Ask a homework question - tutors are online