5: Complexity Flashcards

1
Q

What is an oracle?

A

A black box that is used with TMs that answer or solve difficult problems in one call.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a computation resource? List 5.

A

An asset that enables computations of increased complexity and difficulty.

time; space; energy; the number of comparisons; the number of calls to an oracle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you measure time and space complexity in TMs?

A

Time ≑ the number of transitions made by TM.

Space ≑ the number of tape cells touched by TM.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an instance of a problem?

A

An input word that falls within (the language of) a problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Consider a positive non-decreasing function 𝑓 ∢ N β†’ N, 𝐿 a language, L, (over some alphabet 𝐴),
and 𝑛 being the length of the input to f(n).

True/false: DTIME(𝑓 (𝑛)) > {𝐿 | 𝐿 is decided by some (deterministic) TM in at most 𝑓 (𝑛) transitions}

A

False. Here, DTIME(𝑓 (𝑛)) = {𝐿 | 𝐿 is decided by some (deterministic) TM in at most 𝑓(𝑛) transitions}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a complexity class?

A

A set of computing problems, grouped by the time and space complexities that they require to solve.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you determine the complexity class(es) of languages?

A

Consider how the number of transitions and tape cells/stack size needed changes asymptotically for inputs of different length into machines recognising the language. You can do so for both deterministic and nondeterministic machines and find for either or both if the language lies within (takes to solve) constant, linear, polynomial, logarithmic, exponential, etc, time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does ∈^? mean?

A

A ∈^? B = whether A is an element of the set B. (?)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the big O notation mean?

A
  • If 𝑓 (𝑛) = 𝑂(𝑔(𝑛)), then 𝑔 is at least as big as 𝑓
  • 𝑓 is at most a constant times 𝑔
  • βˆƒπ‘ > 0, 𝑛0. βˆ€π‘› > 𝑛0. 𝑓 (𝑛) < 𝑐𝑔(𝑛)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the little o notation mean?

A
  • If 𝑓 (𝑛) = π‘œ(𝑔(𝑛)), then 𝑓 is infinitely smaller than 𝑔
  • 𝑓 (𝑛)/𝑔(𝑛) = 0
  • βˆ€πœ– > 0.βˆƒπ‘›πœ–. βˆ€π‘› > π‘›πœ–. 𝑓 (𝑛) < πœ–π‘”(𝑛)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the big omega notation mean?

A
  • If 𝑓 (𝑛) = Ξ©(𝑔(𝑛)), then 𝑓 is at least as big as 𝑔
  • 𝑓 is at least a constant times 𝑔
  • 𝑔 = 𝑂(𝑓 (𝑛))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the little omega notation mean?

A
  • If 𝑓 (𝑛) = πœ”(𝑔(𝑛)), then 𝑓 is infinitely smaller than 𝑔
  • 𝑔(𝑛)/𝑓 (𝑛) = 0
  • 𝑔 = π‘œ(𝑓 (𝑛))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the big theta notation mean?

A
  • If 𝑓 (𝑛) = Θ(𝑔(𝑛)), then 𝑓 and 𝑔 are the same size
  • 𝑓 and 𝑔 are within a constant factor
  • 𝑓 = 𝑂(𝑔(𝑛)) and 𝑓 = Ξ©(𝑔(𝑛))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Consider a positive non-decreasing function 𝑓 ∢ N β†’ N, 𝐿 a language, L, (over some alphabet 𝐴),
and 𝑛 being the length of the input to f(n).

True/false: DSPACE(𝑓 (𝑛)) > {𝐿 | 𝐿 is decided by some (deterministic) TM in at most 𝑓 (𝑛) tape cells}

A

False. Here, DSPACE(𝑓 (𝑛)) = {𝐿 | 𝐿 is decided by some (deterministic) TM in at most 𝑓 (𝑛) tape cells}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Are input tape cells (or whole tapes dedicated to holding input in multi-tape TMs) counted as part of space complexity? Why?

A

No. So the space complexity represents the number of tape cells to solve a problem: cells to take input are not part of those cells.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When is 𝑇(𝑛) 𝑂(𝑓 (𝑛))?

A

There exist constants 𝑐 and a 𝑛0 > 0 such that for all 𝑛 > 𝑛0, 𝑇(𝑛) ≀ 𝑐 β‹… 𝑓 (𝑛). Intuitively, 𝑇(𝑛) grows no more than 𝑓 (𝑛) for large 𝑛. This is an asymptotic upper bound.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

When is 𝑇(𝑛) o(𝑓 (𝑛))?

A

For every 𝑐 > 0 there exists a 𝑛0 > 0 such that for all 𝑛 > 𝑛0, 𝑇(𝑛) ≀ 𝑐 β‹… 𝑓 (𝑛). Intuitively, 𝑇(𝑛) grows strictly slower than 𝑓 (𝑛) for large 𝑛. This is an asymptotic upper bound.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

When is 𝑇(𝑛) Ξ©(𝑓 (𝑛))?

A

There exist constants 𝑐 and a 𝑛0 > 0 such that for all 𝑛 > 𝑛0, 𝑇(𝑛) β‰₯ 𝑐 β‹… 𝑓 (𝑛). Intuitively, 𝑇(𝑛) grows no less than 𝑓 (𝑛) for large 𝑛. This is an asymptotic lower bound.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

When is 𝑇(𝑛) Ο‰(𝑓 (𝑛))?

A

For every 𝑐 > 0 there exists a 𝑛0 > 0 such that for all 𝑛 > 𝑛0, 𝑇(𝑛) β‰₯ 𝑐 β‹… 𝑓 (𝑛). Intuitively, 𝑇(𝑛) grows strictly faster than 𝑓 (𝑛) for large 𝑛. This is an asymptotic lower bound.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

When is 𝑇(𝑛) Θ(𝑓 (𝑛))?

A

There exist constants 𝑐1, 𝑐2, and a 𝑛0 > 0 such that for all 𝑛 > 𝑛0, 𝑐1β‹… 𝑓 (𝑛) ≀ 𝑇(𝑛) ≀ 𝑐2β‹… 𝑓 (𝑛). Intuitively,𝑇(𝑛) grows like 𝑓 (𝑛) for large 𝑛. This is an asymptotic tight bound.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the Time Speedup Lemma?

A

Let 𝐿 ∈ DTIME(𝑓 (𝑛)). Then, for any 𝑐 > 0,
𝐿 ∈ DTIME(𝑓 β€²(𝑛)) where 𝑓′(𝑛) = 𝑐𝑓 (𝑛) + 𝑂(𝑛).

If you increase the number of states and alphabet size (by a constant factor depending on 𝑐), so that the new TM can make β‰₯ 𝑐 transitions for each transition of the original TM, then in 𝑂(𝑛) time, we can encode the original input.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the Tape Compression Lemma?

A

Let 𝐿 ∈ DSPACE(𝑓 (𝑛)). Then, for any 𝑐 > 0,
𝐿 ∈ DSPACE(𝑓 β€²(𝑛))where 𝑓′(𝑛) = 𝑐𝑓 (𝑛) + 𝑂(1).

If you increase the number of states and alphabet (by a constant factor depending on 𝑐), the new TM can use β‰₯ 𝑐 cells for each tape cell used of the original TM.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Let 𝑓 be a positive non-decreasing function 𝑓 ∢ N β†’ N
Let 𝐿 be a language (over some alphabet 𝐴),
and 𝑛 be the length of the input.

True/false: NTIME(𝑓 (𝑛)) = {𝐿 ∣ There is some nondeterministic TM 𝑀 such that for any word 𝑀 ∈ 𝐿, any computation path takes at most 𝑓 (𝑛) transitions}

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Let 𝑓 be a positive non-decreasing function 𝑓 ∢ N β†’ N
Let 𝐿 be a language (over some alphabet 𝐴),
and 𝑛 be the length of the input.

True/false: NSPACE(𝑓 (𝑛)) = {𝐿 ∣ There is some nondeterministic TM 𝑀 such that for any word 𝑀 ∈ 𝐿, any computation path takes at most 𝑓 (𝑛) additional tape cells}

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Let 𝑓 be a positive non-decreasing function 𝑓 ∢ N β†’ N
Let 𝐿 be a language (over some alphabet 𝐴),
and 𝑛 be the length of the input.

True/false: NSPACE(𝑓 (𝑛)) = {𝐿 ∣ There is some certificate 𝑐 such that 𝐿 is decided by a Deterministic TM which takes 𝑐 as additional input using at most 𝑓 (𝑛) additional tape cells}

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Let 𝑓 be a positive non-decreasing function 𝑓 ∢ N β†’ N
Let 𝐿 be a language (over some alphabet 𝐴),
and 𝑛 be the length of the input.

True/false: NTIME(𝑓 (𝑛)) = {𝐿 ∣ There is some certificate 𝑐 such that 𝐿 is decided by a Deterministic TM which takes 𝑐 as additional input using at most 𝑓 (𝑛) transitions}

A

True.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

How can you define DTIME?

A

Consider a positive non-decreasing function 𝑓 ∢ N β†’ N, 𝐿 a language, L, (over some alphabet 𝐴),
and 𝑛 being the length of the input to f(n).

DTIME(𝑓 (𝑛)) = {𝐿 | 𝐿 is decided by some (deterministic) TM in at most 𝑓(𝑛) transitions}

28
Q

How can you define DSPACE?

A

Consider a positive non-decreasing function 𝑓 ∢ N β†’ N, 𝐿 a language, L, (over some alphabet 𝐴),
and 𝑛 being the length of the input to f(n).

DSPACE(𝑓 (𝑛)) = {𝐿 | 𝐿 is decided by some (deterministic) TM in at most 𝑓 (𝑛) tape cells}

29
Q

How can you define NTIME?

A

Let 𝑓 be a positive non-decreasing function 𝑓 ∢ N β†’ N
Let 𝐿 be a language (over some alphabet 𝐴),
and 𝑛 be the length of the input.

NTIME(𝑓 (𝑛)) = {𝐿 ∣ There is some certificate 𝑐 such that 𝐿 is decided by a Deterministic TM which takes 𝑐 as additional input using at most 𝑓 (𝑛) transitions}

AND

NTIME(𝑓 (𝑛)) = {𝐿 ∣ There is some nondeterministic TM 𝑀 such that for any word 𝑀 ∈ 𝐿, any computation path takes at most 𝑓 (𝑛) transitions}

30
Q

How can you define NSPACE?

A

Let 𝑓 be a positive non-decreasing function 𝑓 ∢ N β†’ N
Let 𝐿 be a language (over some alphabet 𝐴),
and 𝑛 be the length of the input.

NSPACE(𝑓 (𝑛)) = {𝐿 ∣ There is some nondeterministic TM 𝑀 such that for any word 𝑀 ∈ 𝐿, any computation path takes at most 𝑓 (𝑛) additional tape cells}

AND

True/false: NSPACE(𝑓 (𝑛)) = {𝐿 ∣ There is some certificate 𝑐 such that 𝐿 is decided by a Deterministic TM which takes 𝑐 as additional input using at most 𝑓 (𝑛) additional tape cells}

31
Q

Within which time and space complexities can you copy an input from an input tape to a working tape in a multi-tape TM? How could you improve this for the language 𝐿(0 ^ (2 ^ π‘š))?

A

Copying across would take DTIME(2𝑛 log2(𝑛)) and DSPACE(𝑛).

You could instead have a binary number to count the number of input symbols on the working tape, incrementing it every time you read a new input symbol. Since the language is a number of 0s equal to a power of 2, after reading them all the working tape will consist of a 1 and all 0s afterwards. This improves space complexity to DSPACE(log2(𝑛)) and time complexity to ??.

32
Q

When finding complexity classes with nondeterministic computation, do we take the worst, best, or average computational path, in terms of complexity/

A

Use the worst-case paths.

33
Q

What is the time hierarchy theorem?

A

The idea that you can increase the computational power of a system by increasing its time complexity.

For a time-constructible function f(n),

Let f(n) * log(f(n)) = o(g(n)).

Then DTIME(g(n)) \ DTIME(f(n)) β‰  βˆ…

So there are more problems that can be done in f(n) time that can’t be done in g(n) time if f(n) is time-constructible and f(n) > g(n) + log(n).

34
Q

What does it mean for a function to be time-constructible?

A

A function, f(n), is called time constructible if there is a TM, which given the string 1 ^ n as input stops, with f(n) on its tape (in binary) after f(n) transitions (time). If a function is o(n) then it cannot be time constructible.

35
Q

What is diagonalisation, and Cantor’s diagonalisation method?

A

Diagonalisation is when you take a matrix or set, and build a new row in which every ith element is different from the ith element in the ith row (so complement of a bit if binary).

Cantor applied diagonalisation to show that the matrix of all infinite binary sequences is infinite (uncountable) since the new row from diagonalisation will be different from every other row. Assuming the set is countable, you should be able to enumerate all its elements as s0 to sn as described but the new row made by diagonalisation contradicts this as it is not in the set, proving the set of all binary sequences to be uncountable and infinite by proof by contradiction.

36
Q

What is the proof for the Time Hierarchy Theorem?

A

??

37
Q

What is the Space Hierarchy Theorem?

A

Any increases in asymptotic space increases a system’s computational power.

Let f(n) = o(g(n)), where f(n) is space-constructible.

Then DSPACE(g(n)) \ DSPACE(f(n)) β‰  βˆ…

So there are more problems that can be done in f(n) space that can’t be done in g(n) space if f(n) is space-constructible and f(n) > g(n).

38
Q

What does it mean for a function to be space-constructible?

A

A function, f(n), is called space-constructible if there is a TM, which given the string 1 ^ n as input stops with f(n) on its tape (in binary) while using f(n) tape cells (space).

39
Q

What is the proof for the Space Hierarchy Theorem?

A

??

40
Q

What are the consequences of the Time and Space Hierarchy Theorems

A
  • DTIME(n ^ 2) is strictly more powerful than DTIME(n)
  • DTIME(n ^ 1042) is strictly more powerful than DTIME(n ^ 1041)
  • If d > c >= 1, DTIME(n ^ d) is strictly more powerful than DTIME(n ^ c).
  • DTIME(n ^ Ο€) is strictly more powerful than DTIME(n ^ e) since Ο€ > e.
  • DSPACE(n * log(n)) is strictly more powerful than DSPACE(n).
  • DTIME(2 ^ n) is strictly more powerful than DTIME(n ^ 3)
  • Much more time (or space) means more problems solvable
41
Q

How are DSPACE and NSPACE related?

A

DSPACE(𝑓 (𝑛)) βŠ† NSPACE(𝑓 (𝑛))

42
Q

How are DTIME and NTIME related?

A

DTIME(𝑓 (𝑛)) βŠ† NTIME(𝑓 (𝑛))

43
Q

How do you mathematically define deterministic polynomial time complexities?

A

P = βˆͺ π‘˜β‰₯1 DTIME(𝑛^π‘˜)

So the union of all factors raised to some k where k >= 1

44
Q

How do you mathematically define deterministic exponential time complexities?

A

EXP = βˆͺ π‘˜β‰₯1 DTIME(2^ (𝑛 ^ π‘˜))

So some factor raised to some variable in turn raised to some constant

45
Q

Why and how are the polynomial and exponential time complexity classes different?

A

In polynomial, the factor is raised to a constant k; in exponential, the factor is raised to a variable n that is itself raised to a constant k.

46
Q

How do you mathematically define deterministic logarithmic space complexities?

A

L = DSPACE(log 𝑛)

47
Q

What is NPSPACE?

A

nondeterministic polynomial space complexity

48
Q

How can you mathematically relate NPSPACE and DSPACE?

A

PSPACE = βˆͺ π‘˜β‰₯1 DSPACE(𝑛^π‘˜)

49
Q

True/false: P problems βŠ‚ EXP problems.

A

True.

50
Q

Prove that P problems βŠ‚ EXP problems.

A

??

51
Q

How are the larger complexity classes related?

A

P ⊊ EXP
NP ⊊ NEXP
L ⊊ PSPACE ⊊ EXPSPACE

P βŠ† NP
PSPACE βŠ† NPSPACE
EXP βŠ† NEXP

52
Q

What is the Non-deterministic Time Hierarchy Theorem?

A

Let𝑓 (𝑛 + 1) log 𝑓 (𝑛 + 1) = π‘œ(𝑔(𝑛)).

Then NTIME(𝑔(𝑛)) \ NTIME(𝑓 (𝑛)) β‰  βˆ…

53
Q

What is the Non-deterministic Space Hierarchy Theorem?

A

Let𝑓 (𝑛) = π‘œ(𝑔(𝑛)).

Then NSPACE(𝑔(𝑛)) \ NSPACE(𝑓 (𝑛)) β‰  βˆ…

54
Q

How can you relate time and space complexities?

A

NTIME(𝑓 (𝑛)) βŠ† DSPACE(𝑓 (𝑛))

AND

NSPACE(𝑓 (𝑛)) βŠ† βˆͺ𝑐DTIME(𝑐𝑓 (𝑛))

55
Q

Prove NTIME(𝑓 (𝑛)) βŠ† DSPACE(𝑓 (𝑛))

A

??

56
Q

How can you relate space and time, determinism and non-determinism?

A

DTIME(𝑓 (𝑛) βŠ† NTIME(𝑓 (𝑛)) βŠ† DSPACE(𝑓 (𝑛))

P βŠ† NP βŠ† PSPACE

AND

DTIME(𝑓 (𝑛)) βŠ† NTIME(𝑓 (𝑛)) βŠ† DSPACE(𝑓 (𝑛))
βŠ† NSPACE(𝑓 (𝑛)) βŠ† DTIME(2𝑂(𝑓 (𝑛)))

P βŠ† NP βŠ† PSPACE βŠ† NPSPACE βŠ† EXP

57
Q

Prove NSPACE(𝑓 (𝑛)) βŠ† βˆͺ𝑐DTIME(𝑐𝑓 (𝑛))

A

??

58
Q

How can you relate Non-deterministic vs Deterministic Space?

A

Let𝑓 (𝑛) β‰₯ log 𝑛. Then

NSPACE(𝑓 (𝑛)) βŠ† DSPACE((𝑓 (𝑛))^ 2)

59
Q

Prove NSPACE(𝑓 (𝑛)) βŠ† DSPACE((𝑓 (𝑛))^ 2)

A

??

60
Q

How can you relate Nondeterministic vs Deterministic Time?

A

NP βŠ† EXP

P βŠ† NP

61
Q

Can you get additional power by adding a constant amount of time and/or space?

A

No.

62
Q

What happens when adding a β€œlarge” amount of time and/or space?

A

Adding a β€œlarge” amount of time and/or space gives a strict hierarchy of complexity classes.

63
Q

Can we relate complexity classes (time vs space)?

A

Yes, some.

64
Q

True/false: All regular languages are DSPACE(1).

A

True.

65
Q

What is the significance of all regular languages being DSPACE(1)?

A

Don’t need any more tape cells than those used by the input word. They’re recognised by DFAs, which have no memory and so can be turned into TMs that recognise the same language using tape cells only also used to take input.