Comprehensive Theoretical Comp Sci

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Describe the TRAVELING SP algorithm and state its class.

Description: given a set of cities and the distance between every pair of cities. The problem is to find the shortest possible route that visits every city EXACTLY ONCE and returns to the starting point. 1. Consider city 1 as starting point (arbitrary). 2. Generate all (n-1)! Permutations of city 3. Calculate the cost of every permutation and keep track of the minimum permutation cost. 4. Return the permutation with minimum cost. Time Complexity : O(n!)

Emptiness Testing for CFG

E-cfg = { <G> | G is a CFG and L(G) = ∅} ( does CFG genearte no strings whatsoever) M on input <G> G is a CFG 1. Mark all terminals of G 2. Repeat until no new variables are marked 3. Mark any variable t that has a rule A 🠮U1U2...Uk until all marked. 4. If S is marked, reject If S is NOT MARKED, accept

Equivalence Testing CFG

EQ-cfg = {<G, H> | G and H are CFGs L(G) = L(H)} NOT DECIDABLE

Equivalence Testing for Regular Expression

EQ-dfa = {<A, B> | A and B are DFAs and L(A) = L(B)} M = on input <A, B> 1. Minimize A to get A' 2. Minimize B to get B' 3. Check if A' is isomorphic to B' if so, accept else REJECT!

What is the Time Complexity for DFA to REGEX?

EXPONENTIAL

What is the Time Complexity of NFA to DFA? describe it

EXPONENTIAL

Describe the EULER algorithm and state its class

Euler = {<G, s t> | G is a graph with an Eulerian path (traverse each edge exactly once) from s to t } Build TM M to decide Euler: M = on input <G ,s, t > where G is a graph 1. Compute the degrees of all nodes in G. 2. If s = t AND all the nodes are even degree, accept; else reject. 3. If s ≠ t AND s , t are odd degree AND all others even, accept else reject.

Describe General PROOF FOR ALL NP

FORWARD PROOF have polytime verifier, V. runs in time n^k Build NDTM that runs in polytime N = on input w of length n 1. ND select a string c of length at most n^k 2. Run V on input <w,c> 3. If V accepts, accept else reject BACKWARD PROOF have NDTM that is polytime N Build polytime verifier V = on input <w,c> w and c are srings 1. Run N on input w, using c ot direct N on which ND choice to make 2. If N accepts, accept; else reject

Describe 2MS to Partition

For 2MS, upon an input of a set of integers, calculate the total time available to be 2D, the total time used to be Σxi. Therefore the idle time is I = 2D - Σxi. Now, idle time may be divided between 2 machines in exponential number of ways. To partition idle time accurately, send to partition additional numbers that sum up to I and sum from 0 to I. Use polynomial length of numbers.

Emptiness Testing for Regular Expression

Given a DFA, does this DFA accept NO STRINGS Edfa = {<A> | A is a DFA and L(A) = ∅} M = on input <A> A a dfa 1. Mark start state 2. Repeat until no new nodes marked 3. Mark any unmarked node with transition into it from a marked node. 4. If no final states are marked accept; else reject.

Describe the HAMILTON algorithm and state its class.

HAMPATH = {<G,s,t> | Gis a graph that has path from s to t and goes through every node exactly once} there is no known polytime solution. However HAMPATH can be verified in polynomial time.

Describe the Halting Problem

Halt TM is undecidable (Proof by contradiction) Assume HaltTm is decidable and R is TM that decides Build TM to decide Atm S = on input <M, w> 1. Run R on <M,w> 2. If R rejects, Reject 3. If R accepts, proceed to next phase Simulate M on input w if M accepts, Accept if M rejects, Reject

What is the General Reduction Proof

If A is polytime reducible to B, and B is a member of poly-time decidable languages, then A is a member of polytime decidable languages.

Proving Something is a member of NP ( using verfier method )

If any problem is in NP, then given a certificate which is a solution to the problem and an instance of the problem, we will be able to verify the certificate in polynomial time.

What makes a language polynomially verifiable?

If it has a polytime verifier. The verifier uses a certificate to verifier that string w belongs to A.

What makes a language Decidable

Iff some NDTM decides it

What makes a language T-Recognizable

Iff some NDTM recognizes it

Prove that the intersection a CFL and a Regular Language is CF

L = C ⋂ R where L and C are context free and R is regular langauge. Let P be the DFA for C Let D be the DFA for R Let Q be set of states for P Let Q' be set of states for D Construct PDA P' that will do everything P will do and slo keep track of D, Q x Q'. P' will accept a string w iff it stops at an accept state q, belonging to FPxFD where FP and FD are the final states for P and D respectively. Since C ⋂ R is recognized by P' then cfl intersection is proved

Describe NDTM closure under Star

Let L be a T-recog language and M be the TM that recognizes. Build TM to recognize L⋆ M = on input w 1. Non-deterministically divide the string w into w1 , w2 ... wn 2. Run Mstar for each of these divided parts 3. If all divided parts are accepted by Mstar, then accept. Else REJECT.

Describe Deciding TM closure under Complement.

Let L be a decidable language and M be the TM that decides it Build TM for ⊺_ (Lcomplement) M = w on input 1. Run M on w, If M accepts then reject If M rejects then accept

Describe Deciding TM closure under Star.

Let L be decidable and TM M decides it Build TM M to decide L⋆ M = on input w 1. Split w into n part such that w = w1w2......wn in different ways. 2. Run M on Wi for i = 1, 2 ... n If M accepts each of these strings Wi then accept 3. If all attempts have been made without success, then reject.

Describe CFL closure under Union

Let L1 and L2 be context-free languages Formally Defined, G(L1) = {V1, E1, R1 S1} and G(L2) = {V2, E2, R2, S2} To build a union grammar S 🠮 S1 | S2 Fully Formally Defined, G = (V1 U V2 U {S}, E, R1 U R2 U {S🠮S1|S2}, S) and V1 ∩ V2 = ∅ (disjoint)

Describe CFL closure under Concatenation

Let L1 and L2 be context-free languages Formally Defined, G(L1) = {V1, E1, R1 S1} and G(L2) = {V2, E2, R2, S2} To build a union grammar S 🠮 S1 ⋅ S2 Fully Formally Defined, G = (V1 U V2 U {S}, E, {R1 U R2 U {S🠮S1S2}, S) and V1 ∩ V2 = ∅ (disjoint)

Describe Deciding TM closure under Union.

Let L1 and L2 be decidable and TM M1 and M2 decide respectively Build M to decide L1 U L2 M = on input W 1. Copy w to tape 2 2. Simulate M1 on w using tape 1 if M1 accepts, then accept. 3. Simulate M2 on w using tape 2 if M2 accepts, then accept if M2 rejects, then reject

Describe Deciding TM closure under concatenation.

Let L1 and L2 be decidable and TM M1 and M2 decide respectively Build M to decide L1 ∘ L2 M = on input W 1. For every way to split w = w1w2 2. Copy w1 to tape 2. Run M1 on tape 1 Copy w2 to tape 2. Run M2 on tape 2 3. If both accept, then accept. 4. If all ways tried without success, reject

Describe Deciding TM closure under Intersection.

Let L1 and L2 be decidable and TM M1 and M2 decide respectively Build M to decide L1 ∩ L2 M = on input W 1. Simulate M1 on w using tape 1. If reject, then reject. 2. Simulate M2 on w using tape 2. If reject, then reject. Else Accept

Describe NDTM closure under Union

Let L1 and L2 be recognizable and TM M1 and M2 recognize. Build TM M to recognize L1 U L2 M = on input w 1. Copy w to tape 2 2. Run M1 on w using tape 1 and M2 on w using tape 2 NOTE: Run in parallel. Meaning alternate steps of M1 and M2 3. If either M1 or M2 encounters Qaccept, accept 4. If both enter Qreject, then reject

Describe NDTM closure under Concatenation

Let L1 and L2 be recognizable and TM M1 and M2 recognize. Build TM M to recognize L1 ∘ L2 M = on input w 1. divide each string of L1 ∘ L2 into w1 and w2 nondeterministically 2. Run M1 on w1. If M1 halts and rejects, reject 3. Run M2 on w2. If M2 accepts then accept. If halts and rejects, reject.

Describe NDTM closure under Intersection

Let L1 and L2 be recognizable and TM M1 and M2 recognize. Build TM M to recognize L1 ∩L2 M = on input w 1. Run M1 on w. If it accepts then run M2 on w. 2. If M2 accepts then they both accept so accept Else Reject

Describe CFL closure under Star

Let L1 be context-free languages Formally Defined, G(L1) = {V1, E1, R1 S1} To build a union grammar S 🠮 S1 ⋅ S | ∊ Fully Formally Defined, G = (V1 U {S}, E, {R1 U {S🠮S1 ⋅ S | ∊}, S)

Describe the General Reduction Proof

Let M be the polytime algorithm deciding B and f be the polytime reduction from A to B. Here is a polytime algorithm N to decide A: N = "on input <w> 1. Compute f(w) 2. Run M on input f(w) and output whatever M outputs." N runs in polytime because steps 1 and 2 both run in polytime, and the output of stage 1 can only be polylength in size of the original input.

Construction of an NFA N to recognize Union (Regular language closed under Union)

Let N1 = (Q1, Σ, δ1, q1, F1) recognize A1, and N2 = (Q2, Σ, δ2, q2, F2) recognize A2. Construct N = (Q, Σ, δ, q0, F) to recognize A1 ∪ A2. 1. Q = {q0} ∪ Q1 ∪ Q 2. The states of N are all the states of N1 and N2, with the addition of a new start state q0. 2. The state q0 is the start state of N. 3. The set of accept states F = F1 ∪ F2. The accept states of N are all the accept states of N1 and N2. That way, N accepts if either N1 accepts or N2 accepts. 4. Define δ so that for any q ∈ Q and any a ∈ Σε

Construction of N to recognize concatenation (Regular language closed under Concatenation)

Let N1 = (Q1, Σ, δ1, q1, F1) recognize A1, and N2 = (Q2, Σ, δ2, q2, F2) recognize A2. Construct N = (Q, Σ, δ, q1, F2) to recognize A1 ◦ A2. 1. Q = Q1 ∪ Q2. The states of N are all the states of N1 and N2. 2. The state q1 is the same as the start state of N1. 3. The accept states F2 are the same as the accept states of N2. 4. Define δ so that for any q ∈ Q and any a ∈ Σε

Construction of N to recognize Star (Regular language closed under Star)

Let N1 = (Q1, Σ, δ1, q1, F1) recognize A1. Construct N = (Q, Σ, δ, q0, F) to recognize A∗ 1 . 1. Q = {q0} ∪ Q1. The states of N are the states of N1 plus a new start state. 2. The state q0 is the new start state. 3. F = {q0} ∪ F1. The accept states are the old accept states plus the new start state. 4. Define δ so that for any q ∈ Q and any a ∈ Σε,

What 2 conditions make a language NP Complete

1. B ∈ NP 2. every A ∈ NP is polynomial time reducible to B. (∀(A ∈ NP) ≤p B)

Acceptance Problem for NFAs

1. Convert N to DFA 2. Simulate N on input w 3. If N ends on Final state, Accept, else Reject

Describe 3-SAT reducible to VERTEX COVER

1. For each literals draw nodes for true and false and draw edge between them. 2. For each clause draw a triangle of nodes and draw edges between them. m = # of variables and l = # of clauses. # nodes = 2m + 3l and size of vertex cover(k) = m + 2l. In a vertex cover, every edge gets covered(picked). Within nodes pick what makes it true. Within each clause pick 3 that don't make it true. Conclusion: If we do end up with a VC then we have a true solution for 3SAT.

How do you show something is context free?

1. Give a CFG for it. 2. Make a PDA.

How do you something is decidable?

1. Give a Single Tape Turing Machine 2. Give an algorithm for it.

Describe Algorithm for converting NDTM to DTM and describe the algorithm.

1. Initially tape 1 has input w, tape 2 and 3 are empty 2. Copy w to tape 2 3. Use tape 2 to simulate NDTM's operation Before each step, consult tape 3 to see which choice to make If no more symbols on tape 3 (illegal/invalid choice) (encounter Qreject, proceed to next step) 4. Replace string on tape 3 with next value in string order 5. Go back to STEP 2.

Define Time Complexity ( 3 PART)

1. Let M be a deterministic TM that halts on all inputs 2. Time complexity, of M is a function f: N🠮N 3. where f(n) is the max number of steps that M uses on any input of length n.

Describe PARTITION TO SUBSET-SUM

1. Partition will give you a list of numbers. 2. Divide the sum of those numbers by 2 to obtain H. 3. Send all multiset partition values to subset sum with H as the target T. 4. If H is an integer, check if values in subset-sum meet the target. If Yes, then we are polytime reducible and the problem is solved 5. If H is not an integer. then send an integer value of H that is guaranteed to fail as a target. So if partition is solvable then subset-sum is also solvable.

Describe Algorithm for Converting Multitape to Single Tape and describe Time complexity

1. Put standard tape(single tape) into proper form 2. a) to simulate a single move, scan tape to determine the symbols under the virtual heads b) scan again to update tape's/ perform actions according to M's transition function 3. If at any time, an action would move virtual head unto #, instead shift right from here to end of tape, insert #dot Time complexity 1. O(N) 2. Single move(t(N)) conclusion: every t(n) time multitape has O(t^2(n)) single-tape

A Non-Det FSM is a 5 Tuple: Define It.

1. Q is a finite set call the states 2. Σ is a finite set called the alphabet 3. δ : Q x Σ > P(Q) is the transition function 4. q0∈ Q is the start state 5. F ⊆ Qis the set of accept states

Pushdown Automata (PDA) is a 6 Tuple: Define It.

1. Q is the set of states 2. Σ is the input alphabet 3. Γ is the stack alphabet 4. δ : Q x Σ εx Γε −> P(Q X Γε) is the transition function 5. q0 ε Q is the start state 6. F ⊆ Q is the set of accept states

Turing Machine is a 6 Tuple: Define It

1. Q is the set of states 2. Σ is the input alphabet not containing the blank symbol _ 3. Γis the tape alphabet where _ ∈ Γ and Σ⊆Γ 4. δ : Q xx Γ −> Q X ΓX {L,R} is the transition function 5. q0ε Qis is the start state 6. qacceptε Q is the accept state 7. qreject ε Qis the reject state where qreject =/ qaccept

Describe ways to find the left-hand edge of the tape.

1. Shift Right 2. Mark and attempt left 3. Special Symbols: a) augmented symbol replaces 1st position b) Remembered with tape.

What are Context Free Languages Closed Under?

1. Union 2. Concatenation 3. Kleene Star

What are Recognizing Turing Machines Closed Under?

1. Union 2. Kleene Star 3. Concatenation 4. Intersection

What are Decidable Turing Machines Closed Under?

1. Union 2. Kleene Star 3. Concatenation 4. Intersection 5. Complement

What are Regular Languages Closed Under?

1. Union 2. Kleene Star 3. Concatenation 4. Intersection 5. Complement

What is Class P Closed Under?

1. Union 2. Kleene Star 3. Concatenation 4. Intersection 5. Complement

Context Free Grammar is a 4 Tuple: define it.

1. V is a finite set called the variables 2. Σ is a finite set disjoint from V called terminals 3. R is a finite set of rules, with each rule being a variable and a string of variables and terminals 4. S∈ V is the start variable.

What are the 6 conditions for a Regular Expression??

1. a for some a in the alphabet Σ 2. ε 3. empty language 4. where and are (R1⋃R2) R1 R2 regular expressions 5. (R1 ° R2) where R1 and R2 are regular expressions 6. (R1 *) where R1 is a regular language

How do you show something is a regular language?

1. give a regular expression for it. 2. draw a DFA diagram for it 3. use closure properties

Describe 3-SAT reducible to CLIQUE

1.Draw nodes for each literal in each clause and label. 2. Within a Clause ( no edges) 3. Draw edges Between clauses (do not contradict) 4. (clique requires k size = number of clauses ) 5. then there is at least one node that makes each clause true and there is guaranteed to be a CLIQUE BTW each clause.

Describe the 2MACHINE SCHEDULING algorithm and state its class.

2MS = {<S, D> | S = {x1, ... xk}, a set of process times and D a deadline, and there is a way to schedule the k processes on 2 machines within the deadline} NP class

Describe 2ms to SUBSET SUM

2MS ≤p PAR ≤p Subset Sum

Describe the 3SAT algorithm and state its class.

3SAT = {<𝝓> | 𝝓 is a satisfiable 3CNF formula} NP class

Describe the CONNECTEDNESS algorithm and state its class

A = {<G> | G is an undirected connected graph} TM(algo) to decide A: M = on input <G> G is an undirected graph 1. Mark first node 2. Repeat until no new nodes are marked 3. Mark any unmarked node connected by edge to marked node. 4. Scan nodes to see if all are marked. If so, accept If not, reject.

Show Isomorphism is in NP

A ND polynomial time algorithm for ISA operates as follows. "On input <G,H> where G and H are undirected graphs. 1. Let m be the number of nodes of G and H. If they don't have the same number of nodes, REJECT. 2. Non-deterministically select a permutation PI of elements. 3. For each pair of nodes x and y of G check that (x,y) is an edge of G iff (PI(x),PI(y)) is an edge of H. If all agree, ACCEPT, If any differ, REJECT

What makes a language in NP?

A language is in NP iff it is decided by some nondeterministic polynomial time Turing machine (NDTM).

Prove CFL not closed under complement/intersection

A n B = double complement of (A n B) = All comp (Acomp U B comp). This would be valid if we were closed under complement but we are not.

Describe the CLIQUE algorithm and state its class.

A subgraph in an undirected graph that is a complete graph. A k-clique contains k nodes. CLIQUE: {<G, k> | G is an undirected graph with a k-clique}

Describe the INDEPENDENT SET algorithm and state its class.

A subgraph in an undirected graph, where no two nodes are connected by an edge. IS = { <G, k> | G is an undirected graph with a k-sized independent set}

Describe the SUBSET SUM algorithm and state its class.

A subset of a given multiset of integers that adds up to the target, t.SUBSET SUM = {<S, t> | S = {x1, ... xk} and for some {y1, ... yj} ⊆ S, we have ∑yi = t}

Describe the VERTEX COVER algorithm and state its class.

A vertex cover of G is a subset of the nodes where every edge of G touches one of those nodes C = {<G, k> | G is an undirected graph with a k-node vertex cover} NP class

Acceptance Problem for DFAs

A-DFA = {<B, w> | B is a DFA that accepts input string w} Solution: m = on input <B, w> 1. Simulate B on input w 2. If B ends on Final state, Accept. Else Reject

Acceptance Problem for CFG

A-cfg {<G, w> | G is a CFG that generates string w} M = on input <G, w> 1. Convert G to CHOMSKY NORMAL FORM. 2. If w = ∊, check whether So🠮∊ exists, If yes, accept 3. Generate all derivations of length 2n-1, n = |w|. If any of these is w, accept ELSE reject.

Acceptance Problem for REX

A-rex = {<R, w> | R is a REX that accepts input string w} Solution : m = on input <R, w> 1. Convert R to a NFA, N 2. Convert N to a DFA, D 3. Simulate D on input w 4. If D ends in a final state, accept ELSE reject.

Describe the PATH algorithm and state its class

Algorithm to determine if there is a path between 2 nodes. M = "on input <G, s, t> where G is a directed graph with a path between nodes s and t: 1. Place mark on node S 2. Repeat until no new nodes are marked 3. Scan edges of G. If edge (a,b) is found going from marked node a to unmarked node b 4. If t is marked accept. Else Reject. Time Complexity: 2's loop executes O(m) times where m is #of nodes. The rest steps run in polynomial time in size of the graph.

State the Church-Turing thesis

Any turing machine that halts on all inputs can be considered an algorithm, and any algorithm can be rendered as a turing machine that halts on all inputs

Prove A(TM) is NOT decidable

Assume Atm is decidable, then obtain a contradiction. Let H be decider for Atm, that is, on input <M, w> where M is a TM and w is a string H(<M,w> = (1. accept, if M accepts w 2. reject, if M does not accept w) Now, consider a TM D with H as a sub-routine D = "on input <M>, where M is a TM 1. Run H on input <M, <M>> 2. Output the opposite of what H outputs, if H accepts, reject and if H rejects, accept. Now run D using <D> as input D(<D>) = (1. accept, if D does not accept <D> 2. reject , if D accepts <D>) therefore CONTRA!

Prove Acceptance for TM ( Turing Recognizable)

Atm = {<M, w> | M is a TM and M accepts w} Here is a TM 'U' to recognize it where U = universal TM U = {<M, w> | M is a TM and w a string} 1. Simulate TM M on input w 2. If M does enter Qaccept, then accept 3. If M does not enter Qaccept, OR enters Qreject, REJECT

Prove that Every CFG is Decidable

Build TM M to decide CFL A Build a copy of grammar G into Mg Mg = on input w 1. Convert G to CHOMSKY NORMAL FORM 2. If w = ∊, check to see if So🠮∊ is a rule. If yes, accept else reject. 3. List all derivations of length 2n-1, n = |w|. If w is generated accept; else reject.

Acceptance Problem for PDA

Convert A-pda to CFG then A-pda {<G, w> | G is a CFG that generates string w} M = on input <G, w> 1. Convert G to CHOMSKY NORMAL FORM. 2. If w = ∊, check whether So🠮∊ exists, If yes, accept 3. Generate all derivations of length 2n-1, n = |w|. If any of these is w, accept ELSE reject.

Estimate Time Complexity for A ={a^k b^k}

M = "on input<w>: 1. Scan the tape and reject if an "a" is found to the right of a 'b' 2. Repeat while both a's and b's remain on the tape 3. Scan the tape crossing off exactly one an and exactly one b. 4. Scan tape: if either a or b symbols remain, then reject else accept. a. O(n) 2. O(n/2) 3. O(n) total time complexity is O(n^2)

Estimate Time Complexity for A ={a^k b^k} using Two Tapes

M = on input <w> 1. Scan tape across tape 1; reject if an a symbol is found to the right of a b symbol ( putting the tape in the proper form) 2. Scan a's on tape 1 until the first b. At the same time, copy the a's unto tape 2. 3. Scan b's on tape1 until end of tape. For each b found on tape 1, cross off an a on tape 2. 4. REJECT IF: all a's are crossed off before all b's processed If after matching, extra a's remain 5. ACCEPT IF: BOTH match i.e all a's have been crossed off. total time complexity for this is O(n) linear time

Describe NP/NDTM algorithm for Hamiltonian Path

N1 = On input <G, s ,t> where G is a directed graph with nodes s and t. 1. Write a list of m numbers, p1....pm where m is the number of nodes in G. Each number in the list is nondeterminstically selected to be between 1 and m. 2. Check for repetitions in the list. If any are found, reject 3. check whether s = P1 and t = Pm. If either fail, reject 4. For each I between 1 and m-1, check whether (pi, pi+1) is an edge of graph G. If any are not, REJECT. Otherwise all tests have been passed so accept.

Describe the PARTITION algorithm and state its class.

PAR = {<S> | S = {x1, x2, x3....xk} and π exists such that ∑𝑥𝑖 ∈𝜋𝑥𝑖 = ∑ 𝑥𝑖 ∉𝜋𝑥𝑖} NP class

What is the Time Complexity FOR ACCEPTANCE DFA

POLYNOMIAL

What is the Time Complexity of REGULAR EXPRESSION TO NFA

POLYNOMIAL

What is the Time Complexity to describe DFA ISOMORPHISMS.

POLYNOMIAL

What is the Time Complexity to minimize a DFA?

POLYNOMIAL

Enumerators

RL: Recognizes: DFA, NFA Generates: RegEx CF: Recognizes: PDA Generates: CFG TM: Recognizes: TM Generates: Enumerators

Describe Partition to 2MS

Start with set of integers in partition and then divide said integers by 2 to obtain H. Our deadline for 2ms is H. Therefore whenever we send H to 2MS, the only way 2ms will find an answer if if we are a partition with 2 sets. In other words. If our partition can be solved within this deadline then we are poly reducible and the problem is solved. If we have a non integer value for H/D then use the flooring technique to round down and send an integer to 2MS. Downside is that said integer will FAIL 2MS test and not be considered partition. Greater than H is impossible and Less than H is incorrect

Describe Subset sum to 2MS

Subset Sum ≤p PAR ≤p 2MS

Describe SUBSET-SUM to PARTITION

Subset sum starts with multiset of integers with t as target. Miracle Option: If H=t then send to partition and partition will divide correctly and problem solved by polytime reduction. However If H not equal to T then add on two extra values to original set: namely Xn+1 = 2H + 2t and Xn+2 = 4H. Send original plus new values to partition. Then place new values on opposite sides of partition. Add half of original values(H) to both sides. Perform Algebra to discover that t = H. If so, then partition has been solved with polynomial time reduction and therefore subset has also been solved. And if subset sum is solved then partition is also solved.

Show that Triangle belongs in NP

The following algorithm decides TRIANGLE On input G: For each triplet of vertices (u, v, w) in G Return true if G contains all edges (u, v), (v,w) (w, u) else Return False. Remark. By definition of TRIANGLE, the algorithm will return true iff G contains a triangle. Let n = |V| (number of vertices) and m = |E| (edges) in G. There are O(n^3) many triplets of vertices in G and it is possible to ennumerate in time O(n^3). For each triplet, it takes time O(m) to verify presence of three edges. So the algorithm rjns in time O(mn^3).

What is the running time of a NDTM?

The running time is the function f: N🠮N where f(n) is the max no. of steps that N uses on any branch of its computation on an input of length n.

Describe NP algorithm for Subset Sum

V = <on input <S,t>,c>:1. Test whether c is a collection of numbers that sum up to t. 2. Test whether s contains all the numbers in c. 3. If both pass, accept; otherwise reject.

Describe the SAT algorithm and state its class.

a Boolean formula that has a variable combination that evaluates as true SAT = {<𝝓> | 𝝓 is a satisfiable Boolean formula} NP class

What is the Class NP

class of languages for which membership can be verified quickly ( verified)

What is the Class P

class of languages or which membership can be decided quickly(solvable)

A Deterministic FSM is a 5 Tuple: Define It.

deterministic finite state machine is a 5tuple ( Q, Σ, δ, q0,F)where 1. Q is a finite set call the states 2. Σ is a finite set called the alphabet 3. δ : Q x Σ > Q is the transition function 4. q0∈ Q is the start state 5. F ⊆ Qis the set of accept states

What is Dynamic Programming?

is a method in which a problem is broken into smaller subproblems whose solutions are stored and results are used to solve the larger problems

State Cook-Levin thesis

states that the Boolean satisfiability problem is NPcomplete. That is, any problem in NP can be reduced in polynomial time by a deterministic Turing machine to the problem of determining whether a Boolean formula is satisfiable.

Describe NP algorithm for Clique

{<G,k>|G is an undirected graph with a k-clique} 1. Build a verfier V for clique V = "on input <G, k,c> 1. Test whether c is a subgraph with k nodes in G. 2. Test whether G contains all edges connecting nodes in C 3. If both pass, accept; else reject. 2. Build a polynomial time NDTM N = "on input" <G, k> where G is a graph. 1. Nondeterministically select a subset c of k nodes of G 2. Test whether G contains all edges connecting nodes in C. 3. If yes, accept; otherwise reject

Describe HAMPATH certificate

{w| V accepts <w, C>} and w = <G, s, t> and c is a path that visits each vertex exactly once.


Ensembles d'études connexes

Broken Bonds Quick Check | Unit 2 Lesson 4

View Set

Check your knowledge: Single provider CPR/AED

View Set

CCNA 2 Test 3 Chs 7-9 part 2 of 3

View Set

Final Exam Review Questions and Answers All Units

View Set

Chapter 8: Conservation of Energy

View Set