CECS 329-Midterm 2

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/190

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:15 AM on 5/11/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

191 Terms

1
New cards

Which statement about the cardinalities of the set of natural numbers N = {1, 2, 3, ... } and the set of even natural numbers 2N = {0, 2, 4, 6, ... } is correct?

|N| = |2N|

2
New cards

Which statement about the cardinalities of the set A and its power set P(A) is correct?

|A| < |P(A)|

3
New cards

How are the cardinalities of the sets N of natural numbers, Q of rational numbers, and R of real numbers related to each other?

|N| = |Q| < |R|

4
New cards

Let Σ be an alphabet. A language A ∈ Σ * is called regular if there is a finite automaton M such that... A is the language of 𝑀.

𝐴=𝐿(𝑀).

𝑀 recognizes 𝐴. All other options are correct

All other options are correct.

5
New cards

All languages are regular.

No

6
New cards

GNFAs, NFAs, and DFAs are all equivalent, i.e. they all recognize the same class of languages.

Yes, they all recognize regular languages.

7
New cards

Which of the following languages are decidable?

ANFA = {

ADFA = {

EQDFA = {

ATM = {| A is a Tm and accepts A}

ANFA = {

ADFA = {

EQDFA = {

8
New cards

What does the Church-Turing-Thesis say?

Any real-world computation can be translated into an equivalent computation performed by a Turing machine.

9
New cards

What is a Turing Machine?

A theoretical machine to model and reason about computation.

10
New cards

Decidability of languages does not depend on the model of computation.

True

11
New cards

The complexity class P does depend on the model of computation

Yes, but it is equivalent for all reasonable deterministic models of computation.

12
New cards

Languages in P can be efficiently decided. Yes, that's the meaning of the class P.

Not at all, problems in P generally have a high time complexity.

Not necessarily. The time complexity might be 𝑂(𝑛𝑘) whith a very large value for 𝑘.

Not necessarily. The time complexity might be O(n^k) with a very large value for k

13
New cards

Which of the following statements are correct:

All decidable languages are in the complexity class P.

All languages in P are T-recognizable.

All languages in P are decidable.

All regular languages are in the complexity class P

All languages in P are T-recognizable.

All languages in P are decidable.

All regular languages are in the complexity class P

14
New cards

What is the definition of the Bachmann-Landau big O notation? f(n) in O(g(n)) <->

∃k > 0 ∃n0 ∀n > n0 |f(n)| <= kg(n)

15
New cards

What is the known relationship between the complexity classes N and NP?

P ⊆ NP (P is subset of NP)

16
New cards

What is the definition of mapping reducibility (also called many-one reducibility)?

if there is a computable function f : Σ∗ → Γ∗ such that w ∈ A <=> f(w) ∈ B .

17
New cards

Is it true that TIME(t(n)) ⊆ SPACE(t(n))?

Yes, because we need at least one computational step to write into a new memory cell.

18
New cards

A language B is NP-Complete iff

... B is in NP and any language A in NP can be polynomially reduced to B.

19
New cards

Which of these languages are NP-Complete? HALT (Halting Problem)

SAT (Boolean Satifiability)

PATH (Path Problem)

3-SAT (3-CNF Boolean Satifiability)

SAT and 3-SAT

20
New cards

What is the definition of an alphabet Σ ?

Σ is a non-empty, finite set.

21
New cards

A language A ⊆ Σ ∗ is polynomial time reducible to the language B ⊆ Γ ∗ and we write A ≤p B

... if there is a function f : Σ∗ → Γ∗ computable in polynomial time such that w ∈ A <=> f(w) ∈ B .

22
New cards

If we would find a proof for SAT ∈ P then this would imply that

P = NP

It allows you to solve all of NP in P

23
New cards

Are all regular languages in the complexity class P ?

Yes, because a DFA reads one input symbol per state transition.

24
New cards

How can we describe the complexity classes P and NP informally?

NP = All languages where we can verify membership quickly.

P = All languages where we can test membership quickly

25
New cards

Which of the following boolean expressions are in 3-CNF?

(u ∨ y! ∨ z) ∧ (x ∨ v ∨ z) ∧ (x ∨ y! ∨ w!)
(x ∨ y! ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y! ∨ z!)
(u ^ y! ^ z) V (x ^ v ^ z) V (x ^ y! ^ w!)
(x ^ y! ^ z) V (x ^ y ^ z) V (x ^ y! ^ z!)

(u ∨ y! ∨ z) ∧ (x ∨ v ∨ z) ∧ (x ∨ y! ∨ w!)

(x ∨ y! ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y! ∨ z!)

26
New cards

Is SAT NP-complete?

Yes

27
New cards

Two models of computation are polynomially related if each can simulate the other with a polynomial overhead, i.e. if the computation takes t(n) time on one model it may take t k(n) time on the other model, for some k . Which of the following are polynomially related to a 1-tape Turing Machine?

random access machines (RAM)

multi-dimensional Turing Machines

multi-tape TMs

cellular automata

All reasonable deterministic models are polynomial related: random access machines (RAM), multi-dimensional Turing Machines, multi-tape TMs, cellular automata

28
New cards

Alan Turing proved the undecidability of the halting problem. Which proof technique from set theory did inspire Turing?

Cantor's diagonal argument

29
New cards

What is the output (on the tape) of the Turing Machine M on input 10010111 where

10011000

30
New cards

Is the complexity class P closed under union, ie. does L1 ∈ P and L2 ∈ P imply that L1 ∪ L2 ∈ P?

Yes

31
New cards

Is the following formula satisfiable? (x ∨ y) ∧ (x ∨ y!) ∧ (x! ∨ y) ∧ (x! ∨ y!)

No

32
New cards

Which of the following are true?

3^n ∈ 2^O(n)

n log n ∈ O(n^2)

2n ∈ O(n)

n^2 ∈ O(n)

3^n ∈ 2^O(n)

n log n ∈ O(n^2)

2n ∈ O(n)

33
New cards

Turing machines can...

write

read

write or read

write or read

34
New cards

On input w, a TM M may...

halt or loop

35
New cards

A is T-recognizable if?

if A = L(M) may be found in some TM M in which L(M) is the collection of strings that M accepts

36
New cards

A is T-decidable if?

𝐴 = 𝐿(𝑀) for some TM decider 𝑀. (halts on all inputs and decides to accept or reject)

No loop

37
New cards

Why pick a specific model?

Choice of model doesn't matter. All reasonable models are equivalent in power.

38
New cards

What is a multi-tape Turing machine?

ordinary turing machine with several tapes. Has input tape and work tape that all read/write

39
New cards

Can multi-tape do more than single tape?

No because all models of computation are equivalent in power.

40
New cards

What is a nondeterministic Turing machine?

At any point in a computation, the machine may proceed according to several possibilities.

The computation of a nondeterministic Turing machine is a tree whose branches

correspond to different possibilities for the machine. If some branch of the computation

leads to the accept state, the machine accepts its input.

41
New cards

What is the difference between a Nondeterministic TM and a Deterministic TM?

NTM transition function 𝛿: Q×Γ → 𝒫( 𝑄×Γ× {L, R} ).

42
New cards

What is a turing enumerator?

A deterministic TM with a printer.

It starts on a blank tape and it can print strings 𝑤! , 𝑤" , 𝑤# , ... possibly going forever if it doesn't halt. Its language is the set of all strings it prints. It is a generator, not a recognizer.

For enumerator 𝐸 we say 𝐿 𝐸 = 𝑤 𝐸 prints 𝑤}.

43
New cards

What is Hilbert's 10th problem?

devise an algorithm that tests whether a polynomial

has an integral root. He did not use the term algorithm but rather "a process according to which it can be determined by a finite number of operations."

44
New cards

Why couldn't Hilbert's 10th problem be solve?

Because at the time of release, there was no formal definition for algorithm, i.e. it couldn't be stated that D is not decidable.

45
New cards

Is ADFA decidable?

Yes, ADFA is decidable.

Give TM 𝐷A−DFA that decides 𝐴DFA .

𝐷A−DFA = "On input 𝑠

1. Check that 𝑠 has the form 𝐵,𝑤 where

𝐵 is a DFA and 𝑤 is a string; reject if not.

2. Simulate the computation of 𝐵 on 𝑤.

3. If 𝐵 ends in an accept state then accept.

If not then reject."

46
New cards

Is ANFA decideable?

Yes.

Give TM 𝐷A−NFA that decides 𝐴NFA .

𝐷A−NFA = "On input 𝐵,𝑤

1. Convert NFA 𝐵 to equivalent DFA 𝐵′.

2. Run TM 𝐷A−DFA on input 𝐵′,𝑤 . [ Recall that 𝐷A−DFA decides 𝐴DFA ]

3. Accept if 𝐷A−DFA accepts.

Reject if not."

47
New cards

what is acceptance problem, emptiness problem, and equivalent problem?

algorithms for testing whether a finite automaton accepts a string, whether

the language of a finite automaton is empty, and whether two finite automata are

equivalent.

48
New cards

Is EDFA decidable?

Yes.

Proof: Give TM 𝐷E−DFA that decides 𝐸DFA .

𝐷E−DFA = "On input 𝐵 [IDEA: Check for a path from start to accept.]

1. Mark start state.

2. Repeat until no new state is marked:

Mark every state that has an incoming arrow

from a previously marked state.

3. Accept if no accept state is marked.

Reject if some accept state is marked."

49
New cards

Is EQDFA decidable?

Yes

Proof: Give TM 𝐷EQ−DFA that decides 𝐸𝑄DFA .

𝐷EQ−DFA = "On input 𝐴, 𝐵 [IDEA: Make DFA 𝐶 that accepts 𝑤 where 𝐴 and 𝐵 disagree.]

1. Construct DFA 𝐶 where 𝐿 𝐶 = 𝐿 𝐴 ∩ 𝐿 𝐵 ∪ 𝐿 𝐴 ∩ 𝐿 𝐵 . (Symmetric difference)

2. Run 𝐷E−DFA on 〈𝐶〉 .

3. Accept if 𝐷E−DFA accepts.

Reject if 𝐷E−DFA rejects."

50
New cards

Is ACFG decidable?

Yes

Proof: Give TM 𝐷A−CFG that decides 𝐴CFG .

𝐷A−CFG = "On input 𝐺,𝑤

1. Convert 𝐺 into CNF.

2. Try all derivations of length 2|𝑤| − 1.

3. Accept if any generate 𝑤.

Reject if not.

51
New cards

Is ECFG decidable?

yes.

Proof:

𝐷E−CFG = "On input 𝐺 [IDEA: work backwards from terminals]

1. Mark all occurrences of terminals in 𝐺.

2. Repeat until no new variables are marked

Mark all occurrences of variable A if

A → B!B"⋯B# is a rule and all B% were already marked.

3. Reject if the start variable is marked.

Accept if not."

52
New cards

Is every CFL decidable?

yes

53
New cards

Is EQCFG decidable?

NO, IT IS NOT.

54
New cards

IS AMBIGCFG decidable?

NO, IT IS NOT.

55
New cards

Is ATM decidable?

NO, IT IS NOT.

56
New cards

Is ATM T-recognizable?

Yes.

57
New cards

What is a universal Turing machine?

capable of simulating any other Turing machine from the description of that machine

58
New cards

What is a countable set?

A set A is countable if either it is finite or it has the same size as N. Let N be the set of natural numbers {1, 2, 3, . . .}

59
New cards

Are both ℤ and ℚ+ countable?

Yes

60
New cards

Is R uncountable?

Yes, because Contor's diagonalization method shows a number 𝑥 ∈ ℝ that is missing from the list.

61
New cards

Let L= set of all languages over alphabet Σ. Is L countable?

L is uncountable

62
New cards

Is the set of all Turing machines countable? M= all Turing machines.

Yes because each Turing machine M has an encoding into a string ⟨M⟩. ({<𝑀>| 𝑀 is a TM} ⊆ Σ∗).

63
New cards

Is Σ* countable?

Yes

64
New cards

Are all languages decidable or even T-recognizable?

No, because there are uncountably many languages yet only countably many Turing machines. Because each Turing machine can recognize a single language and there are more languages than Turing machines, some languages are not recognized by any Turing machine.

65
New cards

What is co-Turing-recognizable?

the complement of a Turing-recognizable language.

66
New cards

Is the complement of ATM T-recognizable?

No

67
New cards

A language is decidable when?

A language is decidable iff it is Turing-recognizable and co-Turing-recognizable.

In other words, a language is decidable exactly when both it and its complement are Turing-recognizable.

68
New cards

What is reducibility?

the primary method for proving that problems are computationally unsolvable. A way of converting one problem to another problem in such a way that a solution to the second problem can be used to solve the first problem.

69
New cards

Is HALT TM undecidable?

Yes.

Use our knowledge that 𝐴TM is undecidable to show other

problems are undecidable.

70
New cards

What is the concept of Reducibility?

If we have two languages (or problems) 𝐴 and 𝐵, then

𝐴 is reducible to 𝐵 means that we can use 𝐵 to solve 𝐴.

Example 1: Measuring the area of a rectangle

is reducible to measuring the lengths of its sides.

Example 2: We showed that 𝐴NFA is reducible to 𝐴DFA .

If 𝐴 is reducible to 𝐵 then solving 𝐵 gives a solution to 𝐴.

71
New cards

Is ETM undecidable?

Yes.

Proof by contradiction. Show that 𝐴TM is reducible to 𝐸TM.

Assume that 𝐸TM is decidable and show that 𝐴TM is decidable (false!).

72
New cards

What is Mapping Reducibility?

𝐴 is mapping-reducible to 𝐵 (𝐴 ≤" 𝐵) if there is a computable function 𝑓 where 𝑤 ∈ 𝐴 iff 𝑓 𝑤 ∈ 𝐵.

Example: 𝐴TM ≤" 𝐸TM

The computable reduction function 𝑓 is 𝑓( 𝑀,𝑤 ) = 𝑀#

Because 𝑀,𝑤 ∈ 𝐴TM iff 𝑀# ∈ 𝐸TM

( 𝑀 accepts 𝑤 iff 𝐿 𝑀# ≠ ∅ )

73
New cards

What is Mapping Reduction's properties?

If 𝐴 ≤m𝐵 and 𝐵 is decidable then so is 𝐴

If 𝐴 ≤m 𝐵 and 𝐴 is undecidable then so is 𝐵

If 𝐴 ≤" 𝐵 and 𝐴 is T-unrecognizable then so is 𝐵

74
New cards

What is the benefits of Mapping Reducibility of 𝐴 to 𝐵?

Translate 𝐴-questions to 𝐵-questions.

-A special type of reducibility

- Useful to prove T-unrecognizability

75
New cards

What is the benefits of General) Reducibility of 𝐴 to 𝐵: Use

Use 𝐵 solver to solve 𝐴.

-May be conceptually simpler

- Useful to prove undecidability

76
New cards

What is the difference between Mapping and General Reducibility?

- 𝐴 is reducible to 𝐴

- 𝐴 may not be mapping reducible to 𝐴.

77
New cards

Is ETM T-recognizable?

No.

Use reduction function

78
New cards

Are both EQTM and EQTM' (complement) T-recognizable?

No.

79
New cards

Why do we use the term "reduce"?

When we reduce 𝐴 to 𝐵, we show how to solve 𝐴 by using 𝐵 and conclude that 𝐴 is no harder than 𝐵. (suggests the ≤" notation)

Possibility 1: We bring 𝐴's difficulty down to 𝐵's difficulty.

Possibility 2: We bring 𝐵's difficulty up to 𝐴's difficulty.

80
New cards

What is the difference between computability theory and complexity theory?

Computability: Is A decidable?

Complexity: Is A decidable with restricted resources? (time/memory/etc)

81
New cards

What is worst-case complexity?

An upper bound for all inputs of length n

82
New cards

What is Big O notation?

𝑓(𝑛) is 𝑂(𝑔(𝑛)) if 𝑓(𝑛) ≤ 𝑐𝑔(𝑛)

for some fixed 𝑐 independent of 𝑛.

83
New cards

What is little o notation?

𝑓(𝑛) is 𝑜(𝑔(𝑛)) if 𝑓(𝑛) ≤ 𝜖𝑔(𝑛)

for all 𝜖 > 0 and large 𝑛.

84
New cards

Does the Number of steps to decide 𝐴 = {a^k b^k | 𝑘 ≥ 0} depends on the model?

Yes.

1-tape TM: 𝑂(𝑛 log 𝑛)

Multi-tape TM: 𝑂(𝑛)

85
New cards

What does the computability theory state?

model independence (Church-Turing Thesis)

Therefore model choice doesn't matter. Mathematically nice.

86
New cards

What does the complexity theory state?

model dependence

But dependence is low (polynomial) for reasonable deterministic models.

87
New cards

What is TIME(t(n))?

TIME 𝑡 𝑛 = {𝐵| some deterministic 1-tape TM 𝑀 decides 𝐵 and 𝑀 runs in time 𝑂(𝑡(𝑛)) }

88
New cards

What is the time complexity of regular language?

O(n)

89
New cards

What is the time complexity of converting a multi-tape to a 1-tape turing machine?

O(t^2(n))

Converting squares the amount of time the multi-tape used.

𝑂(𝑡(𝑛) × 𝑡(𝑛)) = 𝑂(𝑡^2(𝑛)) .

90
New cards

What is the relationship among models?

Two models of computation are polynomially related

if each can simulate the other with a polynomial overhead:

So 𝑡 𝑛 time → 𝑡!(𝑛) time on the other model, for some 𝑘.

91
New cards

What is class P?

P = ⋃k TIME(𝑛^k) = polynomial time decidable languages.

Union of all values of k of Time(n^k).

92
New cards

Is class P invariant for all reasonable deterministic models?

Yes

93
New cards

What is the time complexity of PATH ∈ P?

O(n^4) steps

94
New cards

What is HAMPATH?

the path that goes through every node of G

95
New cards

Is HAMPATH ∈ P ?

Unsolved problem in solving HAMPATH using polynomial time. Can using exponential time.

96
New cards

What is a nondeterministic TM decider?

All branches halt on all inputs

97
New cards

What is NTIME(t(n))?

NTIME(t(n)) = {𝐵| some 1-tape NTM decides 𝐵 and runs in time 𝑂(𝑡(𝑛)) }. All branches halt within t(n) steps.

98
New cards

What is NP?

NP = ⋃k NTIME(𝑛^k) = nondeterministic polynomial time decidable languages.

Invariant for all reasonable nondeterministic models

Corresponds roughly to easily verifiable problems

99
New cards

Is HAMPATH ∈ NP?

Yes, because NTM allows you to check all of the paths on different branches.

100
New cards

Is composites (all non-prime numbers) ∈ NP?

Yes