summaryrefslogtreecommitdiffhomepage
path: root/asymptotic-notation.html.markdown
diff options
context:
space:
mode:
authorAdam Bard <github@adambard.com>2015-10-08 11:24:31 +0800
committerAdam Bard <github@adambard.com>2015-10-08 11:24:31 +0800
commitabd7444f9e5343f597b561a69297122142881fc8 (patch)
tree1afa96957269a218ef2a84d9c9a2d4ab462e8fef /asymptotic-notation.html.markdown
parent5c677e8071291520297ef3d5d8374c6d11285744 (diff)
parent960ee4a1856db8eadb96277bb2422edfa8f2a81c (diff)
Merge pull request #1395 from ghalley/spaces
[en] Remove unnecessary whitespace throughout the english files
Diffstat (limited to 'asymptotic-notation.html.markdown')
-rw-r--r--asymptotic-notation.html.markdown26
1 files changed, 13 insertions, 13 deletions
diff --git a/asymptotic-notation.html.markdown b/asymptotic-notation.html.markdown
index e1f961f8..a516737e 100644
--- a/asymptotic-notation.html.markdown
+++ b/asymptotic-notation.html.markdown
@@ -72,45 +72,45 @@ for a given function. Say `f(n)` is your algorithm runtime, and `g(n)` is an arb
you are trying to relate to your algorithm. `f(n)` is O(g(n)), if for any real constant c (c > 0),
`f(n)` <= `c g(n)` for every input size n (n > 0).
-*Example 1*
+*Example 1*
```
-f(n) = 3log n + 100
+f(n) = 3log n + 100
g(n) = log n
```
-Is `f(n)` O(g(n))?
-Is `3 log n + 100` O(log n)?
+Is `f(n)` O(g(n))?
+Is `3 log n + 100` O(log n)?
Let's look to the definition of Big-O.
```
-3log n + 100 <= c * log n
+3log n + 100 <= c * log n
```
-Is there some constant c that satisfies this for all n?
+Is there some constant c that satisfies this for all n?
```
-3log n + 100 <= 150 * log n, n > 2 (undefined at n = 1)
+3log n + 100 <= 150 * log n, n > 2 (undefined at n = 1)
```
Yes! The definition of Big-O has been met therefore `f(n)` is O(g(n)).
-*Example 2*
+*Example 2*
```
-f(n) = 3*n^2
+f(n) = 3*n^2
g(n) = n
```
-Is `f(n)` O(g(n))?
-Is `3 * n^2` O(n)?
+Is `f(n)` O(g(n))?
+Is `3 * n^2` O(n)?
Let's look at the definition of Big-O.
```
-3 * n^2 <= c * n
+3 * n^2 <= c * n
```
-Is there some constant c that satisfies this for all n?
+Is there some constant c that satisfies this for all n?
No, there isn't. `f(n)` is NOT O(g(n)).
### Big-Omega