Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fe879e2

Browse files
added notes for 2.3 dominance relations
1 parent 78cac62 commit fe879e2

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
layout: post
3+
title: 2.3 Growth Rates and Dominance Relations
4+
---
5+
6+
## Growth rates
7+
8+
The growth rate of its time complexity functions can easily render an algorithm impractical even for relatively small inputs. Below are some complexity functions and the input ranges where they become unusable:
9+
10+
* O(n!) ~ n ≥ 20
11+
12+
* O(2^n) ~ n > 40
13+
14+
* O(n^2) ~ n > 100,000
15+
16+
* O(n) and O(n lg n) ~ n > 1 bn
17+
18+
* O(lg n) ~ any imaginable n
19+
20+
## Dominance relations
21+
22+
* the Big Oh notation groups functions into a set of classes.
23+
* functions belonging to each class are considered equal with respect to Big Oh
24+
* a faster-growing function class dominates a slower-growing one
25+
26+
Function classes
27+
28+
* **Constant functions**, f(n) = 1, no dependence on the parameter n (e.g adding two numbers)
29+
* **Logarithmic functions**, f(n) = log n (e.g binary search)
30+
* **Linear functions**, f(n) = n (e.g looking at each item once in an n-element array)
31+
* **Superlinear functions**, f(n) = n lg n (e.g mergesort)
32+
* **Quadratic functions**, f(n) = n^2 (looking at most or all elements in an n-element universe)
33+
* **Cubic functions**, f(n) = n3 (enumerate through all triples in an n-element universe)
34+
* **Exponential functions**, f(n) = c^n for a given constant c > 1 (e.g enumerating all subsets of n items)
35+
* **Factorial functions**, f(n) = n! (e.g all permutations or orderings of n items)
36+
37+
n! >> 2^n >> n^3 >> n^2 >> n lg n >> n >> lg n >> 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /