# lec0209 - CS 173 Discrete Mathematical Structures Cinda...

This preview shows pages 1–9. Sign up to view the full content.

CS 173: Discrete Mathematical Structures Cinda Heeren [email protected] Rm 2213 Siebel Center Office Hours: W 9:30-11:30a

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Cs173 - Spring 2004
Cs173 - Spring 2004 CS 173 Announcements Homework 4 available.  Due 02/12, 8a. Midterm 1:  2/23/06, 7-9p, location SC 1404.  Send me an email  asap if you have a conflict.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Cs173 - Spring 2004 CS 173 Growth of functions Algorithm “Good Morning” For I = 1 to n    For J = I+1 to n       ShakeHands(student(I), student(J)) Running time of “Good Morning” Time = (# of HS) x (time/HS) + some overhead We want an expression for T(n), running time of “Good Morning” on input of size n.
Cs173 - Spring 2004 CS 173 Growth of functions Algorithm “Good Morning” For I = 1 to n    For J = I+1 to n       ShakeHands(student(I), student(J)) How many handshakes? 1 2 3 4 5 n 1 2 3 4 5 I J n 2 - n 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Cs173 - Spring 2004 CS 173 Growth of functions Algorithm “Good Morning” For I = 1 to n    For J = I+1 to n       ShakeHands(student(I), student(J)) T(n) = s(n 2 - n)/2 + t Where s is time for one HS, and t is time for getting  organized. = O(n 2 ) if ShakeHands() runs in constant  time.
Cs173 - Spring 2004 CS 173 Growth of functions Algorithm analysis is concerned with: Type of function that describes run time (we ignore  constant factors since different machines have different  speed/cycle) Large values of n

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Cs173 - Spring 2004 CS173 Growth of functions Guidelines: In general, only the largest term in a sum matters.  a 0 x n  + a 1 x n-1  + … + a n-1 x 1  + a n x = O(x n ) n dominates lg n.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 26

lec0209 - CS 173 Discrete Mathematical Structures Cinda...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online