Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Big O notation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Infinite asymptotics === {{Dark mode invert|image=yes|[[File:comparison computational complexity.svg|thumb|Graphs of functions commonly used in the analysis of algorithms, showing the number of operations <math>N </math> versus input size <math>n </math> for each function]]}} Big O notation is useful when [[analysis of algorithms|analyzing algorithms]] for efficiency. For example, the time (or the number of steps) it takes to complete a problem of size <math> n</math> might be found to be <math> T(n)=4n^2-2n+2 </math>. As <math> n</math> grows large, the <math> n^2</math> [[Summand|term]] will come to dominate, so that all other terms can be neglected—for instance when <math> n=500</math>, the term <math> 4n^2</math> is 1000 times as large as the <math> 2n</math> term. Ignoring the latter would have negligible effect on the expression's value for most purposes. Further, the [[coefficient]]s become irrelevant if we compare to any other [[Orders of approximation|order]] of expression, such as an expression containing a term <math> n^3</math> or <math> n^4</math>. Even if <math> T(n)=1000000n^2</math>, if <math> U(n)=n^3</math>, the latter will always exceed the former once {{mvar|n}} grows larger than <math> 1000000</math>, ''viz.'' <math display="block"> T(1000000)=1000000^3=U(1000000)</math>. Additionally, the number of steps depends on the details of the machine model on which the algorithm runs, but different types of machines typically vary by only a constant factor in the number of steps needed to execute an algorithm. So the big O notation captures what remains: we write either :<math>T(n)= O(n^2) </math> or :<math>T(n) \in O(n^2) </math> and say that the algorithm has ''order of {{math|n<sup>2</sup>}}'' time complexity. The sign "{{math|1==}}" is not meant to express "is equal to" in its normal mathematical sense, but rather a more colloquial "is", so the second expression is sometimes considered more accurate (see the "[[#Equals sign|Equals sign]]" discussion below) while the first is considered by some as an [[abuse of notation]].<ref name="clrs3" />
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)