Analysis of Algorithms Flashcards
How do you work out the time for an algorithm to be executed?
T(n) = C op x C(n)
Where C op is the time to execute the basic operation on a computer, and C(n) is the number of times it needs to be executed.
Big O notation definition
A function t(n) is said to be in the O(g(n)) denoted by t(n) = O(g(n)) if there exists some positive constant c and some nonnegative integer n0 such that:
t(n) <= cg(n), n>= n0.
lecture 5 if you dont understand
Small o notation definition
Strict upper bound.
A function t(n) is said to be in the o(g(n)) denoted by t(n) = o(g(n)) if there exists some positive constant c and some nonnegative integer n0 such that:
t(n) < cg(n), n >= n0. Not equal to.
Example g(n) = o(n^2), g(n) CANNOT be quadratic
Omega notation Ω
A function t(n) is said to be in the Ω(g(n)) denoted by t(n) = Ω(g(n)) if there exists some positive constant c and some nonnegative integer n0 such that:
t(n) >= cg(n), n >= n0, greater
Big Omega is inverse of Big O
Theta notation θ
A function t(n) is said to be in the θ(g(n)) denoted by t(n) = θ(g(n)) if there exists some positive constant c1 and c2 and some nonnegative integer n0 such that:
c1 g(n) <= t(n) <= c2 g(n), n > n0
you do t(n) = 0(g(n)) and t(n) = Ω(g(n))
log b x = ?
log b x = ( log a x ) / ( log a b)
c = O(?)
c = O(1) for any constant c