CS350: Data Structures Class Notes - Complexity Analysis - Prof. Joseph D. Sloan, Study notes of Data Structures and Algorithms

These class notes from cs350: data structures cover the topic of complexity analysis. Tables showing the growth of different expressions and discussions on the dominance of power terms. The concept of o(n), ω(n), and θ(n) is introduced and the growth hierarchy is presented.

Typology: Study notes

Pre 2010

Uploaded on 08/19/2009

koofers-user-v50-1
koofers-user-v50-1 🇺🇸

9 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS350: Data Structures Class Notes
Class 9: Friday, September 19, 2008
Complexity
This class devoted to complexity. We looked at a table showing how expressions grow:
f[x_] := 2 x^2 + 10 x + 100
g[x_] := 2 x^2
Table[{10^i, f[10^i], g[10^i]}, {i, 0, 10}] // MatrixForm
1 112 2
10 400 200
100 21100 20000
1000 2010100 2000000
10000 200100100 200000000
100000 20001000100 20000000000
1000000 2000010000100 2000000000000
10000000 200000100000100 200000000000000
100000000 20000001000000100 20000000000000000
1000000000 2000000010000000100 2000000000000000000
10000000000 200000000100000000100 200000000000000000000
g[x_] := 2 x^2
h[x_] := x^2
Table[{10^i, g[10^i], h[10^i]}, {i, 0, 10}] // MatrixForm
1 2 1
10 200 100
100 20000 10000
1000 2000000 1000000
10000 200000000 100000000
100000 20000000000 10000000000
1000000 2000000000000 1000000000000
10000000 200000000000000 100000000000000
100000000 20000000000000000 10000000000000000
1000000000 2000000000000000000 1000000000000000000
10000000000 200000000000000000000 100000000000000000000
It should be clear that the power term dominates. (These tables were generated with
Mathematica® with output reformatted slightly.)
The next example show that, eventually, the coefficient doesn't matter as n
goes from 10 to 11 and 100 to 101.
{2*10.0^20, 11.0^20, 2*100.0^75, 101.0^75}
{2.*10^20, 6.7275*10^20, 2.*10^150, 2.10913*10^150}
pf2

Partial preview of the text

Download CS350: Data Structures Class Notes - Complexity Analysis - Prof. Joseph D. Sloan and more Study notes Data Structures and Algorithms in PDF only on Docsity!

CS350: Data Structures Class Notes

Class 9: Friday, September 19, 2008 Complexity This class devoted to complexity. We looked at a table showing how expressions grow: f[x_] := 2 x^2 + 10 x + 100 g[x_] := 2 x^ Table[{10^i, f[10^i], g[10^i]}, {i, 0, 10}] // MatrixForm 1 112 2 10 400 200 100 21100 20000 1000 2010100 2000000 10000 200100100 200000000 100000 20001000100 20000000000 1000000 2000010000100 2000000000000 10000000 200000100000100 200000000000000 100000000 20000001000000100 20000000000000000 1000000000 2000000010000000100 2000000000000000000 10000000000 200000000100000000100 200000000000000000000 g[x_] := 2 x^ h[x_] := x^ Table[{10^i, g[10^i], h[10^i]}, {i, 0, 10}] // MatrixForm 1 2 1 10 200 100 100 20000 10000 1000 2000000 1000000 10000 200000000 100000000 100000 20000000000 10000000000 1000000 2000000000000 1000000000000 10000000 200000000000000 100000000000000 100000000 20000000000000000 10000000000000000 1000000000 2000000000000000000 1000000000000000000 10000000000 200000000000000000000 100000000000000000000 It should be clear that the power term dominates. (These tables were generated with Mathematica ® with output reformatted slightly.) The next example show that, eventually, the coefficient doesn't matter as n goes from 10 to 11 and 100 to 101. {210.0^20, 11.0^20, 2100.0^75, 101.0^75}  {2.10^20, 6.727510^20, 2.10^150, 2.1091310^150}

We looked at the definitions for and distinctions among O(n) (upper bound), Ω (n) (lower bound) and Θ (n) tight bound. We saw that for a polynomial, they are the same. Growth hierarchy: 1, log log n, log, n, n log n, n 2 , n 3 , 2 n , 10 n , n!, n n No homework for Monday other than reading.