Professional Documents
Culture Documents
7K3RPT9C 79
7K3RPT9C 79
7K3RPT9C 79
confirm that. For a problem with n variables and a values per variable, there are
a3n3 paths of length 2 to examine. So the lower bound of the time complexity of
PC-2 is Ω(a3n3).
The upper bound of the time complexity of PC-2 is determined by the number of
iterations in the WHILE loop and the complexity of Revise_Constraint. The number
of iterations required is limited by the number of paths that can go into Q. Paths are
added into Q only when Revise_Constraint deletes at least one element from Ci,j.
1
When i = j, at most n(n + 1) − 2 paths are added to Q. Since there are at most na
2
1
1’s in each of the Ci,j’s, at most na( n(n + 1) − 2) paths can be added to Q. When i
2
1
< j, 2n−2 paths are added to Q. Since there are nC2 = n(n − 1) combinations of i
2
1
and j, at most n(n − 1) a paths can be added to Q as a result of deleting an entry
2
2
from Ci,j. Thus, the number of new entries to Q is bounded by:
1 1
na( n(n + 1 − 2) + n(n − 1)a2(2n − 2)
2 2
1 1
= (a2 + a)n3 + ( a − 2a2)n2 + (a2 − 2a)n
2 2
which is O(a2n3). Since each call of Revise_Constraint goes through each path of
length 2, its worst case time complexity is O(a3). So the overall worst case time
complexity of PC-2 is O(a5n3).
The queue Q contains paths of length 2, and therefore Q’s size never exceeds n3.
There are no more than n2 binary constraints, each of which has exactly a2 ele-
ments. Therefore, the space complexity of PC-2 is O(n3+n2a2).
The efficiency of the PC-2 algorithm can be improved in the same way as AC-3 is
improved to AC-4. The improved algorithm is called PC-4. As is the case in AC-4,
counters are used to identify the relevant paths that need to be re-examined.