Unformatted text preview: overall sense of the nature of the algorithm, what counts is the N 2 part. If we double the size of the input to a program, how does that affect the running time? We use “big Theta” notation to express this sort of approximation. We say that the running time of the sort function is Θ( N 2 ) while the running time of the squares function is Θ( N ). The formal definition is f ( x ) = Θ( g ( x )) ⇔ ∃ k, N | ∀ x > N, | f ( x ) | ≤ k · | g ( x ) | What does all this mean? Basically that one function is always less than another function (e.g., the time for your program to run is less than x 2 ) except that we don’t care about constant factors (that’s what the k means) and we don’t care about small values of x (that’s what the N means). Why don’t we care about small values of x ? Because for small inputs, your program will be fast enough anyway. Let’s say one program is 1000 times faster than another, but one takes a millisecond and the other takes a second. Big deal.takes a second....
View Full Document
This note was uploaded on 02/17/2010 for the course COMPUTER S 26275 taught by Professor Harvey,b during the Spring '10 term at Berkeley.
- Spring '10