Docsity

Problems in Computer Science - Introduction to Computer Science - Lecture Slides, Slides of Computer Science

Partial preview of the text

Download Problems in Computer Science - Introduction to Computer Science - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Some Problems in Computer Science

and Elementary Number Theory

Among most important unsolved problems in mathematics/ computer science

Does P = NP?

Does there exist a polynomial time algorithm to solve the Traveling

Salesman Problem?

Does this graph have a Hamiltonian Path?

NO

(Proof coming later)

What about this graph?

YES

Interesting Special Case of the Traveling Salesman Problem:

Nodes = interval of j + 1- i consecutive integers: [ i , j ]

Permissible pairsums= S = { s 1 , s 2 … }

We say [ i , j ] can be chained by S iff a Hamiltonian path exist.

36

25 16

25 16

25 9

25 36

25

25

36

16 16

25

4 9 25 9

9

36

25

25

36 16

16 25 36

16

25

Problems: (wide range of difficulty)

For what value of n can

[1, n ] be chained by squares?

by cubes?

by k th^ powers?

What is the smallest n such that

[1, n ] can be chained by squares?

Is there a largest n such that

[1, n ] cannot be chained by squares?

If so, what is it?

S= {1, 4, 9, 16, 25, 36, 49, …}

S= {1, 4, 9, 16, 25, 36, 49, …}

  • Since 8 cannot be an endpoint, branch 1-8 must be used.
  • Since 4 cannot be an endpoint, branch 12-4 must be used
  • Since 24 cannot be an endpoint, branches 12-24 and 24-1 must be used
    • But now [24,1,8,17,19,6,10,15,21,4,12] is a disjoint cycle
    • So [1,24] cannot be chained by squares, QED

Can [1,22] be chained by squares?

  • In [1,23], branch 13-3 would force a third endpoint at 12 or 23. So it cannot be used.

What are all solutions of chaining [1,23] by squares?

  • [1,23] can be chained by squares in exactly three different ways, with endpoints {18,9}, {18,2}, or {18,22}. Dotted lines cannot be used.

What are all solutions of chaining [1,23] by squares?

17, 8,^ 1,^ 15,^ 10,^ 6,^ 3,^ 13,^ 12,^ 4,^ 5,^ 11,^ 14,^ 2,^ 7,^9 , 16

Squares can chain [1,n] for n= 15, 16, and 17

And 23:

And 25:

And 26:

And 27:

And 28:

And 29:

And (now trivially) 30 and 31:

25, 11, 5; 4, 12, because {6,19, 30} is the first triangle in the infinite graph.

Here is another solution of 29, 30, and 31:

(31), 18, 7, 29, 20, 16, 9, 27, 22, 14, 2, 23, 26, 10; 15, 1, 3, 6, (30), 19, 17, 8, 28, 21, 4; 5, 11, 25, 24, 12, 13

which extends to a solution of 31 and 32: