CSCI 1112 Lecture 5: Asymptote Behavior

26 views1 pages
7 Feb 2017
School
Course

For unlimited access to Class Notes, a Class+ subscription is required.

Lecture 5: Asymptotic Behavior
Running time analysis
o For eah algorith e at to lassify the asyptoti ehaior of its ork
o Find the best case and the worst case
Asymptotic Notation O (upper bound)
o You can use
F(n) = O(g(n))
You read it f is ig O of g
O gives us the worst case of the algorithm
Asymptotic growth of functions
o How do we compare the following?
8n^2 and 64 n lg n
100n^2 and 2^n
o 64 lg n = O(8n^2) = O(n^2)
Lower Bound
o To find the maximum of n elements, we need n-1 comparisons
o That means that nay algorithm that solves the problem of finding the maximum
ust prefor at least -1 oparisos.
o Not a upper oud ut a loer oud
The absolute minimum that the algorithm must do
o Notation: Omega
Tight Bound
o Asymptotic Notation: theta
Summing up
o To preform a running time analysis of an iterative algorithm
Eah lok of siple stateets: assigets, heks, oputig the
value of a built-in mathematical function is a constant value
If the lok is ithi a for loop ultiply the ostat y the uer of
iterations of the for loop obtaining a strict bound (I.e. theta value)
If the lok is ithi a hile loop multiply the constant by the number
of iterations of the while loop in the worst cast obtaining an upper
bound, O value, and in the best case obtaining a lower bound, i.e. Omega
value
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 1 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$10 USD/m
Billed $120 USD annually
Homework Help
Class Notes
Textbook Notes
40 Verified Answers
Study Guides
1 Booster Class
Class+
$8 USD/m
Billed $96 USD annually
Homework Help
Class Notes
Textbook Notes
30 Verified Answers
Study Guides
1 Booster Class