Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is...
Transcript of Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is...
![Page 1: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/1.jpg)
1
![Page 3: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/3.jpg)
3
nSPACEL log
nNSPACENL log
TM space-by decided | ticdeterminisntOLLntSPACE
TM non space- by decided | ticdeterminisntOLLntNSPACE
k
knSPACEPSPACE
![Page 4: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/4.jpg)
4
![Page 5: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/5.jpg)
5
?
![Page 6: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/6.jpg)
6
![Page 8: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/8.jpg)
8
![Page 9: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/9.jpg)
9
?
![Page 10: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/10.jpg)
10
![Page 11: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/11.jpg)
11
![Page 12: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/12.jpg)
12
![Page 13: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/13.jpg)
13
?
![Page 14: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/14.jpg)
14
![Page 15: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/15.jpg)
15
![Page 17: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/17.jpg)
1
2
3
4
5
617
U d/2 W d/2 V
![Page 18: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/18.jpg)
18Complexity
©D.Moshkovits
(a,b,c)=Is there a path from a to b, that takes no morethan c steps.
3Log2(d)
1
4
32
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
(1,4,3)(1,4,3)(1,2,2)(1,4,3)(1,2,2)TRUE(1,4,3)(2,4,1)(1,4,3)(2,4,1)FALSE(1,4,3)(1,3,2)(1,4,3)(1,3,2)(1,2,1)(1,4,3)(1,3,2)(1,2,1)TRUE(1,4,3)(1,3,2)(2,3,1)(1,4,3)(1,3,2)(2,3,1)TRUE(1,4,3)(1,3,2)TRUE(1,4,3)(3,4,1)(1,4,3)(3,4,1)TRUE(1,4,3) TRUE
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
boolean PATH(a,b,d) {
if there is an edge from a to b then
return TRUE
else {
if (d=1) return FALSE
for every vertex v (not a,b) {
if PATH(a,v, d/2) and
PATH(v,b, d/2) then
return TRUE
}
return FALSE
}
}
![Page 19: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/19.jpg)
19
![Page 20: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/20.jpg)
20
![Page 21: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/21.jpg)
Premise
21
![Page 22: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/22.jpg)
22
Yes
No
![Page 23: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/23.jpg)
23
![Page 24: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/24.jpg)
24
![Page 25: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/25.jpg)
25
Induction:
![Page 26: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/26.jpg)
26
![Page 27: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/27.jpg)
reachs(v, l)
1. length = l; u = s
2. while (length > 0) {3. if u = v return ‘YES’
4. else, for all (u’ V) {
5. if (u, u’) E nondeterministic switch:
5.1 u = u’; --length; break
5.2 continue}
}6. return ‘NO’
27Complexity
©D.Moshkovits
Takes up logarithmic space
This N.D. algorithm might never stop
![Page 28: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/28.jpg)
CRs ( d )
1. count = 0
2. for all uV {3. countd-1 = 0
4. for all vV {5. nondeterministic switch:
5.1 if reach(v, d - 1) then ++countd-1 else fail
if (v,u) E then ++count; break5.2 continue
}
6. if countd-1 < CRs (d-1) fail
}
7.return count28Complexity
©D.Moshkovits
Recursive call!
Assume (v,v) E
![Page 29: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/29.jpg)
CRs ( d
1. count = 0
2. for all uV {3. countd-1 = 0
4. for all vV {5. nondeterministic switch:
5.1 if reach(v, d - 1) then ++countd-1 else fail
if (v,u) E then ++count; break5.2 continue
}
6. if countd-1 < fail
}
7.return count29Complexity
©D.Moshkovits
Main Algorithm:
CRs
C = 1
for d = 1..|V|
C = CR(d, C)
return C
parameter
C
, C)
![Page 30: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/30.jpg)
30
![Page 31: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/31.jpg)
Variables` range is
31
![Page 32: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/32.jpg)
32Complexity
©D.Moshkovits
xy[(xy)(xy)]
y[(0y)(0y)] y[(1y)(1y)]
(00)(00) (01)(01) (11)(11)(10)(10)
1 0 1
1
0
1
1
![Page 33: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/33.jpg)
33
![Page 34: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/34.jpg)
34
![Page 35: Explore space complexity - TAUsafra/Complexity/Space.pdf · Complexity 18 ©D.Moshkovits (a,b,c)=Is there a path from a to b, that takes no more than c steps. 3Log 2 (d) 1 4 3 2 boolean](https://reader033.fdocuments.in/reader033/viewer/2022050216/5f619bf45522b314910a427c/html5/thumbnails/35.jpg)
35
Space Complexity
Savitch’s Theorem
Log Space Reductions
Immerman’s Theorem
TQBF
Complexity Classes
L NL
PSPACE
Savitch, Walter
Immerman, Neil
Róbert Szelepcsényi