Skip to main content
added 209 characters in body
Source Link
Vincenzo
  • 3.5k
  • 1
  • 13
  • 24

Strictly speaking, $O(f(n))$ is a set of functions. So the value of $O(f(n))$ is simply the set of all functions that grow asymptotically not faster than $f(n)$. The notation $T(n) = O(f(n))$ is just a conventional way to write that $T(n) \in O(f(n))$.

Note that this also clarifies some issuescaveats of the $O$ notation as it is normally used. For example, $n^2 \in O(n^3)$ but $n^3 \notin O(n^2)$. So you couldwe write that $O(n^2) = O(n^3)$$(1/2) n^2 + n = O(n^2)$, but you cannotwe never write $O(n^3) = O(n^2)$, even though one normally expectsthat $=$ to represent an equivalence relation$O(n^2)=(1/2)n^2 + n$. To quote Donald Knuth (in particularThe Art of Computer Programming, symmetric)1.2.11.1):

The most important consideration is the idea of one-way equalities. [...] If $\alpha(n)$ and $\beta(n)$ are formulas that involve the $O$-notation, then the notation $\alpha(n)=\beta(n)$ means that the set of functions denoted by $\alpha(n)$ is contained in the set denoted by $\beta(n)$.

Strictly speaking, $O(f(n))$ is a set of functions. So the value of $O(f(n))$ is simply the set of all functions that grow asymptotically not faster than $f(n)$. The notation $T(n) = O(f(n))$ is just a conventional way to write that $T(n) \in O(f(n))$.

Note that this also clarifies some issues of the $O$ notation as it is normally used. For example, $n^2 \in O(n^3)$ but $n^3 \notin O(n^2)$. So you could write $O(n^2) = O(n^3)$, but you cannot write $O(n^3) = O(n^2)$, even though one normally expects $=$ to represent an equivalence relation (in particular, symmetric).

Strictly speaking, $O(f(n))$ is a set of functions. So the value of $O(f(n))$ is simply the set of all functions that grow asymptotically not faster than $f(n)$. The notation $T(n) = O(f(n))$ is just a conventional way to write that $T(n) \in O(f(n))$.

Note that this also clarifies some caveats of the $O$ notation. For example, we write that $(1/2) n^2 + n = O(n^2)$, but we never write that $O(n^2)=(1/2)n^2 + n$. To quote Donald Knuth (The Art of Computer Programming, 1.2.11.1):

The most important consideration is the idea of one-way equalities. [...] If $\alpha(n)$ and $\beta(n)$ are formulas that involve the $O$-notation, then the notation $\alpha(n)=\beta(n)$ means that the set of functions denoted by $\alpha(n)$ is contained in the set denoted by $\beta(n)$.

added 4 characters in body
Source Link
Vincenzo
  • 3.5k
  • 1
  • 13
  • 24

Strictly speaking, $O(f(n))$ is a set of functions. So the value of $O(f(n))$ is simply the set of all functions that grow asymptotically not faster than $f(n)$. The notation $T(n) = O(f(n))$ is just a simplifiedconventional way to write that $T(n) \in O(f(n))$.

Note that this also clarifies some issues of the $O$ notation as it is normally used. For example, $n^2 \in O(n^3)$ but $n^3 \notin O(n^2)$. So you cancould write $O(n^2) = O(n^3)$, but you cannot write $O(n^3) = O(n^2)$, even though one normally expects $=$ to represent an equivalence relation (in particular, symmetric).

Strictly speaking, $O(f(n))$ is a set of functions. So the value of $O(f(n))$ is simply the set of all functions that grow asymptotically not faster than $f(n)$. The notation $T(n) = O(f(n))$ is just a simplified way to write that $T(n) \in O(f(n))$.

Note that this also clarifies some issues of the $O$ notation as it is normally used. For example, $n^2 \in O(n^3)$ but $n^3 \notin O(n^2)$. So you can write $O(n^2) = O(n^3)$, but you cannot write $O(n^3) = O(n^2)$, even though one normally expects $=$ to represent an equivalence relation (in particular, symmetric).

Strictly speaking, $O(f(n))$ is a set of functions. So the value of $O(f(n))$ is simply the set of all functions that grow asymptotically not faster than $f(n)$. The notation $T(n) = O(f(n))$ is just a conventional way to write that $T(n) \in O(f(n))$.

Note that this also clarifies some issues of the $O$ notation as it is normally used. For example, $n^2 \in O(n^3)$ but $n^3 \notin O(n^2)$. So you could write $O(n^2) = O(n^3)$, but you cannot write $O(n^3) = O(n^2)$, even though one normally expects $=$ to represent an equivalence relation (in particular, symmetric).

Mod Moved Comments To Chat
clarified last paragraph
Source Link
Vincenzo
  • 3.5k
  • 1
  • 13
  • 24

Strictly speaking, $O(f(n))$ is a set of functions. So the value of $O(f(n))$ is simply the set of all functions that grow asymptotically not faster than $f(n)$. The notation $T(n) = O(f(n))$ is just a simplified way to write that $T(n) \in O(f(n))$.

Note that this also clarifies some issues of the $O$ notation as it is normally used. For example, $n^2 \in O(n^3)$ but $n^3 \notin O(n^2)$. So you can write $n^2 = O(n^3)$$O(n^2) = O(n^3)$, but you cannot write $n^3 = O(n^2)$$O(n^3) = O(n^2)$, even though one normally expects $=$ to represent an equivalence relation (in particular, symmetric).

Strictly speaking, $O(f(n))$ is a set of functions. So the value of $O(f(n))$ is simply the set of all functions that grow asymptotically not faster than $f(n)$. The notation $T(n) = O(f(n))$ is just a simplified way to write that $T(n) \in O(f(n))$.

Note that this also clarifies some issues of the $O$ notation as it is normally used. For example, $n^2 \in O(n^3)$ but $n^3 \notin O(n^2)$. So you can write $n^2 = O(n^3)$, but you cannot write $n^3 = O(n^2)$.

Strictly speaking, $O(f(n))$ is a set of functions. So the value of $O(f(n))$ is simply the set of all functions that grow asymptotically not faster than $f(n)$. The notation $T(n) = O(f(n))$ is just a simplified way to write that $T(n) \in O(f(n))$.

Note that this also clarifies some issues of the $O$ notation as it is normally used. For example, $n^2 \in O(n^3)$ but $n^3 \notin O(n^2)$. So you can write $O(n^2) = O(n^3)$, but you cannot write $O(n^3) = O(n^2)$, even though one normally expects $=$ to represent an equivalence relation (in particular, symmetric).

Source Link
Vincenzo
  • 3.5k
  • 1
  • 13
  • 24
Loading