## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

**CSE 3315 - Theoretical Concepts
**

Homework 6- Solution - Fall 2000 Due Date: Dec. 6 2000, 5:30 pm

This algorithm makes iterations (one for each in ). In each iteration it removes one symbol from the ﬁrst number string and makes a copy of the second number string. This requires moving the read head to the beginning of the input string and then moving it across once. The complexity of , making the total complexity of the algorithm since . each iteration is thus b) Binary subtraction can be solved in a way analogous to binary addition. Using a three-tape Turing machine ﬁrst copies the second number to tape and adds ’s to the shorter of the numbers to make them the same length. Then, starting with the least signiﬁcant bit, subtraction is performed bitwise with the carry bit represented in the state of the Turing machine. Assuming state represents the presence of no carry bit and represents the state in which there is a carry bit, subtraction is performed as follows:

# " ¥ ¡ " ¡ &)# ( $ %# ' " &¡ $ %# ! ¦ ¨ § ¢ ¡ ¡ ¨ ©§ ¦

For each bit this subtraction requires a constant number of time steps. The initial copying of the second number requires steps. Therefore, the overall algorithm has complexity and is thus polynomial.

¨ § ¨ ©§

c 2000 Manfred Huber

¥

¤ £¡

¢ £¡

¡

¡

¡

4

4

"

"

"

"

¡

¡

¡

¡

4

4

"

"

"

¡ &)# (

¡ &)# (

¡

4 &# $

4

" 1)# (

" 0# 2

"

"

¡

2 #

2 #

2 #

#

'

'

'

'

'

'

'

'

'

¡

¡

¡

¡

'

'

" &¡

"

"

¡

¡

' 03# (

'52%#

" 0%# $

"

"

"

$ %#

$ #

#

#

#

#

6

1.

a) Unary multiplication can be performed by means of successive addition. The following two-tape Turing machine does this in polynomial time: 1. Check if the ﬁrst number string (initially ) is empty. a) If it is empty the multiplication is ﬁnished and the Turing machine halts. 2. Erase the ﬁrst from the ﬁrst number string. 3. Append a copy of the second number string ( ) to the string on tape . 4. Go to step 1.

Page 1

This procedure has to be performed at times. This takes time . To ﬁnd out if the graph is connected it is sufﬁcient to check if all nodes are reachable from a given start node (since the graph is undirected this implies that there is a path from every node to every other node). 4. To show that a given sentence is satisﬁable it is sufﬁcient to show that one of the conjunctive terms to be not satisﬁable it has to contain is satisﬁable. A sentence of d) Sentences in disjunctive normal form are of the form length has fewer than conjunctive terms. . a two-tape Turing machine can be used to execute the following algorithm. the sentence is not satisﬁable. a) If it does not. The overall complexity is thus . the overall complexity of the algorithm is and thus polynomial. To test satisﬁability we can thus use the following algorithm: 1. b) Otherwise. 1. To determine this. add it to the list on tape . If there are no more conjunctive terms. check if the vertex at the other end of the edge is already on tape . each of which contains fewer than propositions. Go to the ﬁrst conjunctive term.Theoretical Concepts Homework 6: P and NP c) The transition table of an indirected graph contains a list of all vertices and edges of the graph. go to the next conjunctive term and repeat step 2. 2. the sentence is satisﬁable. Go to the next vertex in the list on tape and repeat until no new vertices are added to the list on tape (this list now contains all vertices that can be reached from the ﬁrst vertex). Check if the list on tape contains all vertices of the graph. Since there are at most vertices. To check for a contradictory pair of propositions in a conjunctive term requires to check the whole term once for each proposition. most ¨ § 2 ¨ § 9 GE 9 777 S 777 C777 C777 ¨ S 777 C H 9 E C A 9 QQPTRQQWVQQPQQQDUTRQQP)IGFDB@¨ H 9 bGE 777 C Y 9 C A 9 RQQ©a`X)B@¨ H I9 ©§ ¨ 2 ¨ § ¨ § ¥ ¥ 7 8¥ ¡ ¥ ¥ ¥ ¥ 6 c 2000 Manfred Huber Page 2 . Checking if all vertices are in the list takes steps. If it is not. Copy the ﬁrst vertex from the transition table on tape to tape . a literal and its negation ). For a conjunctive terms of the form a contradiction (i. 3. Check if the conjunctive term contains a pair of literals of the form and .CSE 3315 . Finding all vertices that are directly connected to a given vertex and adding them to the list on the second tape takes time steps. For all edges that are connected to the the selected vertex.e. 2.

Multiplication of 2 integers of size and has complexity (for both unary and binary representations . . then is the inverse modulo of .e.a or the example in class). This requires to go over all vertices in the transition table and can be performed in steps.Theoretical Concepts Homework 6: P and NP c 6 b) For this problem. The length of each of these have to be smaller than (if numbers is thus less than . This again requires checking every edge in the cycle (at most ) against all the transition table. To verify that this is a correct solution to the problem the algorithm then checks if the number of vertices in the cycle is exactly half the number of vertices in the graph. Comparing the result with the input is . c) A cycle can be written as a sequence of vertices that starts and ends with the same vertex and that does not include any other vertex more than once. The length of the result is less than and so on. both of which is an inverse. the overall algorithm is nondeterministic polynomial time. Addition takes is therefore Since the nondeterministic generation of a solution and the veriﬁcation are both polynomial time on a nondeterministic Turing machine. To generate a cycle the algorithm thus nondeterministically generates a sequence of vertices with a maximum length of . To pick one of these numbers and to pick numbers is therefore . the overall algorithm is nondeterministic polynomial time. Each multiplication takes time steps (see time steps and the overall complexity of veriﬁcation 1. a) To show that a problem is in the algorithm ﬁrst nondeterministically picks a solution (in polynomial time) and then veriﬁes the solution (in polynomial time). Then it has to be veriﬁed that all edges in the cycle (i. an edge between every pair of consecutive vertices in the sequence) exist in the transition table of the graph. This makes the veriﬁcation algorithm Since the nondeterministic generation of a solution and the veriﬁcation are both polynomial time on a nondeterministic Turing machine. each of which is no larger than (every number that is the product of more than integers is also the product of exactly integers). The complexity of the ﬁrst multiplication is . In a last step it compares the results of both calculations. For this problem a solution (or more precisely the string that lets us verify the existence of a solution) is a set of different integers. To multiply 5 integers the algorithm multiplies the ﬁrst two. and thus requires time steps. Since the nondeterministic generation of a solution and the veriﬁcation are both polynomial time on a nondeterministic Turing machine. the algorithm multiplies the ﬁve numbers and then compares the result to the input. ¨ ©§ ¨ § ©§ ¨ s s ¨ ©§ 9 9 h ¦ w yx9 ¨ ©§ h ¦ ¦ t vu9 ¦ ¨ § ¡ 9 ¦ c 2000 Manfred Huber Page 3 h ¦ ¨§ ¨©§ ¨ § 2 ¨ ©§ g g r ©§ ¨ e fd 2. and the overall veriﬁcation thus complexity can therefore be done in time steps. the algorithm ﬁrst nondeterministically picks two integers and . so would be ). Then it multiplies and and adds to the result. the overall algorithm is nondeterministic polynomial time. To verify that these are the right numbers the algorithm multiplies and . multiplies the result with the third integer. If they are the same. ¨ r ©§ h ' ¦¨ qpi@©§ ¨ § g g .CSE 3315 . The second multiplication therefore has complexity .a or example in class). All ﬁve multiplications have .see 1. requires time To verify that the integers are a correct factorization of the input.

- Models of Computation
- Algorithm Analysis Big Oh
- Asymptonic Notation Example
- Assembly Line Balancing
- 1999 Operations Research
- Partitions
- nlch
- match78n2_431-458
- Polynomial Series
- module01-1up
- Lecture 01
- 03 Fundamentals
- Quantum Computation III - Slides - Yongjian Han
- 22-Analysis of Algorithms Well
- Big-O notation
- 94 robotics
- Implementing Dataflows With Threads
- Uthesis.ps
- Labeling, Covering and Decomposing of Graphs, Presentation on 18 nov 2009 at Beijing Jiaotong University, P.R.China
- Stan Whitepaper
- Currency
- Smarandache Directionally n-Signed Graphs — A Survey
- hp
- Graph Theory App to Economics
- Imp Codes in Python
- Distributed LTL model-checking in SPIN
- Analytical Entropy and Prime Number Distribution.
- Scimakelatex.338.Popey
- Graph Theory
- CSC373 Assignment 1 Solutions Spring 2012

Skip carousel

- A New S-(a,d) Antimagic Labelling of a Class of Generalized Petersen Graphs
- tmpC906
- Discrete Mathematics
- tmp30E5.tmp
- tmp20DC.tmp
- tmpD746
- A NEW S-(a,d) ANTIMAGIC LABELING OF A CLASS OF CIRCULANT GRAPHS
- Discrete Mathematics MCQ'S
- tmp3C86.tmp
- A Survey
- tmp4359.tmp
- tmp2EBB.tmp
- tmp7F8
- tmp6B5B.tmp
- tmp9F1C
- A Survey on Subgraph Matching Algorithm for Graph Database
- Context Aware Decision Support Mobile Application for Recommendation in the Domain of Hotels
- Algorithm and Data Structure
- Tmp 1387
- Analysis and Design Algorithem
- tmpBF3
- Discrete Mathematics MCQ'S
- tmp3C0A.tmp
- tmpE648
- tmpB0E6
- tmp18A.tmp
- Network Bucket Testing
- tmpDE4.tmp

Sign up to vote on this title

UsefulNot usefulClose Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Close Dialog## This title now requires a credit

Use one of your book credits to continue reading from where you left off, or restart the preview.

Loading