2.2- Asymptotic Notation/ Basic Efficiency Classes Flashcards
To compare and rank such orders
of growth, computer scientists use three notations:
O (big oh), (big omega), and (big theta).
Class: 1
Constant
Short of best-case efficiencies, very few reasonable
examples can be given since an algorithm’s running
time typically goes to infinity when its input size grows
infinitely large.
Class: log n
logarithmic
Typically, a result of cutting a problem’s size by a
constant factor on each iteration of the algorithm (see
Section 4.4). Note that a logarithmic algorithm cannot
take into account all its input or even a fixed fraction
of it: any algorithm that does so will have at least linear
running time.
Class: n
linear
Algorithms that scan a list of size n (e.g., sequential
search) belong to this class.
Class: n log n
linearithmic
Many divide-and-conquer algorithms (see Chapter 5),
including mergesort and quicksort in the average case,
fall into this category
Class: n^2
quadratic
Typically, characterizes efficiency of algorithms with
two embedded loops (see the next section). Elementary sorting algorithms and certain operations on n × n matrices are standard examples.
Class: n^3
cubic
Typically, characterizes efficiency of algorithms with
three embedded loops (see the next section). Several
nontrivial algorithms from linear algebra fall into this
class.
Class: 2^n
exponential
Typical for algorithms that generate all subsets of an
n-element set. Often, the term “exponential” is used
in a broader sense to include this and larger orders of
growth as well.
Class: n!
factorial
Typical for algorithms that generate all permutations
of an n-element set.