Complexity Problems Flashcards
time complexity of an algorithm can be expressed as
a polynomial.
To compare the two algorithms, we can
compare the respective polynomials.
The asymptotic notation compares two functions, say
f(n) and g(n)
for very large values of n.
One of the asymptotic notations is the
Big O notation.
Once we have obtained the time complexity of an algorithm by counting the number of primitive operations, we can arrive at the Big O notation for the algorithm simply by:
Dropping the multiplicative constants with all terms
Dropping all but the highest order term
constant coefficients have become insignificant in the Big-Oh notation
unless both functions have the same order
constants represent the number of —— on a given line of code.
primitive operations
What matters in the the Big-Oh notation is
correctly counting the number of times each line of code is repeated.
how Big-Oh notation is done?
by just counting the number of executions of each line of code, instead of the number of operations.
time complexity involves other types of functions like
<in>
Constant
Logarithmic
Log-square
Root-n
Linear
Linearithmic
Quadratic
Cubic
Quartic
Exponential
Exponential
n-Factorial
</in>
in the ascending order of rate of growth Any function can be given as Big O of any other function that appears ——
later