CSC 320:

Understanding Time Complexity


Back to the notes on NP-completeness.

Table 1: Comparing polynomial and exponential time complexity.
Assume a problem of size one takes 0.000001 seconds (1 microsecond).
Time Complexity Function Size n
102030405060
n0.00001 second0.00002 second 0.00003 second0.00004 second 0.00005 second0.00006 second
n20.0001 second0.0004 second 0.0009 second0.0016 second 0.0025 second0.0036 second
n30.001 second0.008 second 0.027 second0.064 second 0.125 second0.216 second
n50.1 second3.2 second 24.3 second1.7 minutes 5.2 minutes13.2 minutes
2n0.001 second1.0 second17.9 minutes 12.7 days35.7 years 366 centuries
3n0.059 second58 minutes6.5 years 3855 centuries2*108 centuries 1.3*1013 centuries
(from M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-completeness, W. H. Freeman, New York, 1979.)


Table 2: Effect of improved technology on several polynomial and exponential time algorithms.
The following table represents the size of the largest problem instance solvable in 1 hour.
Time Complexity function With present computer With computer 100 times faster With computer 1000 times faster
nN1100 N11000 N1
n2N210 N231.6 N2
n3N34.46 N310 N3
n5N42.5 N43.98 N4
2nN5N5+6.64N5+9.97
3nN6N6+4.19N6+6.29
(from M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-completeness, W. H. Freeman, New York, 1979.)


Exponential growth is huge even if the base is small
Comparing 2n and 3n, it looks like a smaller base is much better than a larger base. However, even a very small base still explodes, if the time period is enough.

According to the CIA:
The land area on earth is about 150 million square kilometres
The population on Earth is about 6000 million.
Thus the average population density is about 40 people / square kilometre.
The current population growth is about 1.5% per year.

1.5% may not sound like much growth, however:
1.0151000 = 2.9 million.
Thus by the year 3000, if the population growth continues at 1.5% per year, the average population density will be 120 people per square metre.
By the year 4000 there will be 350 million people per square metre...


Copied with permission from Dr. David Poole at UBC.

Back to the notes on NP-completeness.