








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
These are the Lecture Slides of Advanced Programming and its key important points are: Asymptotic Analysis, Ignoring Constants, Big-Oh Notation, Major Notations, Asymptotic Upper Bound, Big-Omega, Asymptotic Lower Bound, Big-Theta, Asymptotic Tight Bound, Constant Multiple
Typology: Slides
1 / 14
This page cannot be seen from the preview
Don't miss anything!
Ignoring constants in T ( n ) Analyzing T ( n ) as n "gets large"
Notationally, T(n) = O(n^3 )
Therunningtimegrows"roughlyontheorderofn^3 "
( )
(^3) log T n
n n n^2 n n n soit dominates
As growslarger, isMUCHlarger than , ,and ,
The big-oh ( O ) Notation
functions based on asymptotic behavior of the functions now used to classify functions and families of functions
T(n) = O(f(n)) if there are constants c and n0 such that T(n) < c*f(n) when n ≥ n
c*f(n)
T(n)
n 0 n
_cf(n)_* is an upper bound for T(n)
time of an algorithm
Upper bounds for Insertion Sort running times:
Time Complexity
Classifying Algorithms based on Big-Oh
Base of Logs ignored
loga n = O(logb n)
Power inside logs ignored
log(n^2 ) = O(log n)
Base and powers in exponents not ignored
3 n^ is not O(2n) 2 a (n )^ is not O(a n)
If T(x) is a polynomial of degree n, then T(x) = O(x n)
Q is O(3 n^ ), and that currently both can solve problems of size 50 in 1 hour. If the programs are run on another system that executes exactly 729 times as fast as the original system, what size problems will they be able to solve?
Big-Oh Examples (cont)
n^3 = 50 3 * 729 3 n^ = 3 50 * 729 n = n = log 3 (729 * 3 50 ) n = log 3 (729) + log 3 350 n = 50 * 9 n = 6 + log 3 3 50 n = 50 * 9 = 450 n = 6 + 50 = 56
(^3 503) * (^3729)