SCC121: weeks 11-15 Flashcards
(9 cards)
how does input size to and algorithm affect time complexity of a constant algorithm?
-it doesn’t
-best case, worst case and average case remain the same
for a linear algorithm, how do we calculate the time complexity?
-directly proportional to input size
for a logarithmic algorithm, how do we calculate the time complexity?
-time taken is logarithmically proportional to input size
what is sigma notation?
shorthand for expressing addition sums that may be very long
what is the downside of a binary search?
can only be performed on a sorted list
what is the formal definition of big O?
T(n) is in O(f(n)) if positive constants M and n0 are such that T(n) <= M x f(n) for all n >= n0
what is the formal definition of big Omega?
let T(n) and f(n) be two positive functions
T(n) is omega(f(n)) if even as n becomes arbitrarily large, T(n)’s growth is bounded from below by f(n)- it grows no slower than f(n)
T(n) is part of omega(f(n)) if positive constants M and n0 are such that:
T(n) >= M x f(n) for all n >= n0
what is the formal definition of big theta
let T(n) and f(n) be two positive functions
T(n) is theta(f(n) if even when n becomes arbitrarily large, T(n)’s growth is bounded from above and below by F(n)- it grows no faster or slower than f(n)
T(n) is part of theta(f(n)) if positive constants M1, M2 and n0 such that:
M1 x f(n) <= T(n)<= M2 x f(n) for all n>= n0