Download Goodrich and Tamassia, Section 1.2 Rewritten Using the

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Infinitesimal wikipedia , lookup

Factorization wikipedia , lookup

Function (mathematics) wikipedia , lookup

Non-standard calculus wikipedia , lookup

Factorization of polynomials over finite fields wikipedia , lookup

Addition wikipedia , lookup

Arithmetic wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Positional notation wikipedia , lookup

Bra–ket notation wikipedia , lookup

Large numbers wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Elementary mathematics wikipedia , lookup

History of mathematical notation wikipedia , lookup

Abuse of notation wikipedia , lookup

Musical notation wikipedia , lookup

Big O notation wikipedia , lookup

Transcript
Goodrich and Tamassia, Section 1.2
Rewritten Using the Dominance Notation
B. F. Caviness
September 4, 2001
1.2. Asymptotic Notation
13
In this document, we redo some of the material from section 1.2 of Goodrich
and Tamassia using Collins’ dominance notation instead of the big-oh and associated notations. You should compare this carefully with the corresponding
material from G&T and make sure that you understand both.
Asymptotic Notation
1.2
1.2.1
The Collins’ “Dominance” Notation,
a More Natural Alternative to
The “Big-Oh” Notation
Let f (n) and g(n) be functions mapping nonnegative integers to real numbers.
We say that f (n) – g(n) if there is a real constant c > 0 and an integer constant
n0 ≥ 1 such that f (n) ≤ cg(n) for every integer n ≥ n0 . We say that f (n) is
dominated by g(n) or that g(n) dominates f (n)1 .
Example 1.1: 7n − 2 – n.
Proof: Same as the one in G&T.
Theorem 1.2: The running time of algorithm arrayMax for computing the maximum element in an array of n integers is – n. That is, using the notation
introduced in lecture,
+
tarrayMax
(n) – n.
Example 1.3: 20n3 + 10n log n + 5 – n3 .
Example 1.4: Exercise
Example 1.5: 2100 – 1.
Example 1.6: 5/n – 1/n.
In general, we should use the dominance notation to characterize a function
as closely as possible. While it is true that f (n) = 4n3 + 3n4/3 – n5 , it is more
accurate2 to say that f (n) – n3 .
Theorem 1.7: Let d(n), e(n), f (n), and g(n) be functions mapping nonnegative
integers to nonnegative reals. Then
1. If d(n) – f (n), then ad(n) – f (n) for any real constant a > 0.
2. If d(n) – f (n) and e(n) – g(n), then d(n) + e(n) – f (n) + g(n).
3. If d(n) – f (n) and e(n) – g(n), then d(n)e(n) – f (n)g(n).
4. If d(n) – f (n) and f (n) – g(n), then d(n) – g(n).
5. If f (n) is a polynomial of degree d (that is, f (n) = ad nd + · · · + a1 n + a0 ,
then f (n) – nd .
1 This
2 It
is exactly the same as the definition of big-oh given on p. 13 of G&T.
is even more accurate to say that f (n) ∼ n3 . More about this later.
14
Chapter 1. Algorithm Analysis
6. nx – an for any fixed x > 0 and a > 1.3
7. log nx – log n for any real constant x > 0. For example, log n10 – log n.
8. logx n – √
ny for any real constants x > 0 and y > 0. For example,
10
log n – n.
Using the Big-Oh Notation
The issues discussed in this section of G&T simply do not arise with the
more natural dominance notation. One of the reasons for preferring it to the
big-oh notation!
1.2.2
“Relatives” of the Big-Oh or
Who Needs Relatives with the Dominance Notation?
Just as the dominance notation provides an asymptotic way of saying that a
function is “less than or equal” to another function with the – symbol, it has
two other natural ways of expressing “greater than or equal” with the — symbol
and “asymptotically equal, up to a constant factor” with the ∼ symbol.
Big-Omega and Big-Theta
Let f (n) and g(n) be functions mapping integers to real numbers. We say
that f (n) — g(n) (pronounced f (n) dominates g(n)) if g(n) – f (n). [This the
same as, but much simpler to comprehend than, saying that f (n) = Ω(g(n)).]
Likewise, we say that f (n) ∼ g(n) (pronounced f (n) is co-dominant with g(n))
if f (n) – g(n) and f (n) — g(n). [This is the same as, but much simpler to
comprehend than, saying that f (n) = Θ(g(n)).]
Example 1.9: 3 log n + log log n — log n.
Example 1.10: 3 log n + log log n ∼ log n.
Some Words of Caution
This section of G&T is still relevant.
“Distant Cousins” of the Big-Oh: Little-Oh and Little-Omega
There is a straightforward way of saying that one function is strictly less than
or strictly greater than another asymptotically with the domanince notation
although this idea is used rarely in the analysis of algorithms.
Let f (n) and g(n) be functions mapping integers to real numbers. We say
that f (n) is strictly dominated by g(n) if f (n) – g(n) but it is not the case that
f (n) — g(n). We denote this relationship, quite naturally, by f (n) ≺ g(n).
To show that it is not the case that f (n) — g(n), it is necessary to show that
it is not the case that there exists a real constant c > 0 and an integer n0 such
that cf (n) ≥ g(n) for all n ≥ n0 . To do this it is necessary to show that for
any real constant c > 0 and for any n0 > 1, there exists an n > n0 such that
g(n) > cf (n).
3 That
is, p(n) – an for any polynomial p(n) of fixed degree x and any real constant a > 1.
1.2. ASYMPTOTIC NOTATION
15
To say that f (n) ≺ g(n) is the same as saying f (n) = o(g(n)) (read f (n) is
little-oh of g(n)) or that g(n) = ω(f (n)) (read g(n) is little-ω of f (n)).
Example 1.11: n ≺ 12n2 + 6n ≺ n3 .