Big O Notation - meaning of word
Rozmiar: 8938 bajtów


Big O Notation



#REDIRECT Big O notation

Big O notation



== Algorithms and their Big O performance == I'd like to put in some mention of computer algorithms and their Big O performance: selection sort being N^2, merge sort N log N, travelling salesman, and so on, and implications for computing (faster computers don't compensate for big-O differences, etc). Think this should be part of this write-up, or separate but linked? :''I think separate would be better, to increase the article count :-). Then you can have links from the Complexity, Computation and Computer Science pages. Maybe you can call it "Algorithm run times" or something like that.'' --AxelBoldt :''Or something like'' :analysis of algorithms ''or'' Algorithmic Efficiency ''since you may sometimes choose based on other factors as well. --User:Hornlo'' :''I'd recommend puting it under :computational complexity which earlier I made into a redirect to :complexity theory. It should be a page of it's own, but I didn't want to write it ;-) --User:BlckKnght'' == Amortized complexities == How about a note on amortized complexities? For instance, inserts and lookups in hashtables are O(1) amortized, in constrast with array lookup which is always O(1). == Special name for O(n log n) == doesn't O(n log n) have some special name ? --User:Taw :"linearithmic" was the term coined in Sedgewick, and adopted in some places. --User:Robert Merkel :I've also heard it called "log-linear" --User:Stormix I've heard (and taught) "quasilinear" (because ''f=O(xa)'' for all ''a''>1, as close to 1 as desired), and think this is quite standard and also reasonable. (I plan to add this term on the main page if there is no protest against.) User:MFHUser:MFH: User talk:MFH 13:02, 24 May 2005 (UTC) == Etymology == :The letter "O" comes from the word "order". I remembering it as coming from the Latin word ordo. It makes a bit more sense as Landau, and Bachmann, bringing this notation to us, both were Germans. Obviously, it means the same, but I can see the difference. :) --User:Chexum == Page moves, "Big O" vs other names == Please do not move pages * to less common names (see Wikipedia:Naming conventions (common names)) * without fixing double Wikipedia:redirect --User:Eloquence 15:12 29 May 2003 (UTC) # I believe big oh notation is more common in formal writing. Please refer any CS textbooks. You should find big oh not big O. # because some people may be against the new name like you, so I have to take some time to waint and see. -- User:TakuyaMurata 15:16 29 May 2003 (UTC) : Google shows that "Big O" is twice as common, if you claim that "Big Oh" is more common in textbooks, collect a sample of at least ten random textbooks and demonstrate that more than 5 of them use "Big Oh". --User:Eloquence 15:24 29 May 2003 (UTC) Sure. -- User:TakuyaMurata 15:26 29 May 2003 (UTC) I also vote against the move to "Big oh" until / unless cites are presented to show that it is now the common use: maybe my CS training is old-fashioned, but I recall the use of "big O" thoughout. However, show me the evidence, and I'll be willing to change my mind. User:The Anome 15:27 29 May 2003 (UTC) :Of course, people use big O because it's quick to write than big oh. My claim is isn't big oh notation is common as formal notation. Anyway give me some time. I think I can prove that. -- User:TakuyaMurata 15:37 29 May 2003 (UTC) Here is the result of my research. I couldn't find out ten books containing either big O notation or big oh notation but what is common usage seems apparent. # Paul Walton Purdon, Jr. Cynthia A Brown. "The analysis of algorithm" uses Big O notation as the title of a chapter. # Horowitzw, "Fundamentals of computer algorithms" - in a section Asymptoic Notation ".... One these is the O-notation" # Herbert S.Wilf "Algorithms and Complexity" "...are following five "o" (read 'is little oh of'), 'O' (read is 'big oh of'), ...." # Donald E. Knuth "The art of computer programming" "The O-notation. .... This is the "big oh" notation, ...." # B.M.E Moret H.D.Shapiro "Algorithms from P to NP" "2. Mathematical techniques: 2.1. Big Oh, Big Omega, Big Theta Notations" # Robert Sedgewick "Algorithms" 2nd ed. "... The mathematical artifact for making this notion precise is called the O-notation, or "big oh notation," ...." # Steven C. Altheoen, Robert J.Bumcrot "Introduction to Discrete Mathematics" "... f(n) is said to be of order of maganitude g(n), written f(n) = O(g(n)) and read "f(n) is big oh g(n)," # * Johnsonbaugh Richard, ''Discrete mathematics'' 5th ed. Macmillan, New Jersey - "An expression of the form f(n) = O(g(n)) is sometimes referred to as a big oh notation for f." Except two books, all books I grabed at random above use big oh notation. -- User:TakuyaMurata 19:11 29 May 2003 (UTC) I think some of them may be saying how to ''pronounce'' big-O. Still, Knuth is usually pretty canonical. Can we call the article "O-notation", and direct both big-O and big-oh here? User:The Anome 19:23 29 May 2003 (UTC) :Isn't that the same case in omega and theta? My impression is that he O-notation or the big-O notation is in the same line with big-Θ and big-Ω because O is typically in italic like big-''O'' notation while you cannot italize characters on the Internet. :Besides, actually I want to suggest to name this article asymptoic notations because we certaily want to cover little oh, big-theta and big-omega as well as big-oh. -- User:TakuyaMurata 19:33 29 May 2003 (UTC) Actually no, # Big O # O # O pronounced as "big oh" # O pronounced as "big oh" # Big Oh # O-notation pronounced as "big oh notation" # Big Oh # Big Oh Only three out of 8 refer exclusively to "Big Oh". The other clarify O-notation to be pronounced "Big Oh", this is to avoid confusion with a zero. We already avoid this by having the text "with a capital letter O, not a zero". I see no reason to change the title from "Big O notation", since this is what Google likes the most, perfectly correct and does not require us to fix any double redirects (the way I know Taku's moves, he probably won't do it himself). However, a redirect here is of course acceptable. The page should only be moved to asymptotic notation (note singular) if it actually covers other types of this notation, not in the expectation that it will at some point. --User:Eloquence 19:37 29 May 2003 (UTC) :"the way I know Taku's moves, he probably won't do it himself". What do you mean by this? If you were suggesting I am lazy, it is not the case. I leave old redirects deliberatly so that it's easy to revert my new move. I think it is preferable that move the page and wait for a while to see what other think, while some disagree with this though. -- User:TakuyaMurata 19:46 29 May 2003 (UTC) No, in case of a much-linked page, it's preferable to # Propose the move on the talk page with arguments. Announce that you will move the page within a few days if there are no objections. # If a consensus is reached, move the page and at the very least, fix double redirects (in this case, without editing the redir at Big O, 45 links would suddenly become broken). It is ''not'' desirable to leave Wikipedia in an inconsistent state (in this case, 45 links that suddenly show the user a confusing redirect page, because of the double redir caused by your move) because your move would then be "easier to revert". It should not have to be reverted, because it was properly discussed first. You have the annoying habit of simply moving pages around without prior discussion, in the expectation that people will complain if they disagree. That's correct, they will complain, bud they will also get pissed. If you want to avoid that, discuss first, move later. --User:Eloquence 19:52 29 May 2003 (UTC) :Show me actual examples that annoyed ''you''. If I remember, most of the times, I discuss first and correct redirects if needed. I usually post a proposal at talkpage first. What case are you taking about? Besides, you think this time I should discuss first, but actually you can regard moving as a kind of suggestion. You can think I suggested a new name. If you disagree, you can just revert it. This is the same process to achive NPOV in articles. It is part of discussion. You don't have to be pissed off at all. -- User:TakuyaMurata 02:27 30 May 2003 (UTC) Sorry I think the comment above is not good. Hostility is the last thing we want. I can see oftentimes I piss you off. For example, the last time of datadump. We should be able to have fun not have fight. So my apology of moving this article suddely and I have made a decision that I won't move any article altogether because I don't want to risk to annoy/piss off people. You may think it is extreme but I think it is safe to me because I am often careless. You can see the statement about this in my userpage. -- User:TakuyaMurata 03:10 30 May 2003 (UTC) ------- Anyway above is completely off-topic. Eloquence, you claim Goolgle likes the number of hits with"Big-O notation" is twice as much as that of "Big-oh notation". It is true (by the way, "big o-notation" with 6,450 while "big oh-notation" with 2,990). But my impression is that although big o outweights big-oh, pages with good and formal writing seem to use big-oh notation. First it is consistent with other notations, big-omega and big-theta. Omega and theta are pronounciation of each letter, but so is big-O. Besides, see the list above. Only one textbook uses Big-O notation. I think it is logical to think that the sentence like :''O'', ''&Omega'' and ''&Theta'' (big-Oh, big-Omega, big-Theta) are used in CS. And this is called big-oh notation. I don't mean to be scarstic but I think I am trying to discuss, though maybe I am wrong. -- User:TakuyaMurata 15:17 31 May 2003 (UTC) == "is an element of" vs "equals" == (Forgive the lack of mathematical notation...) Technically speaking, isn't it "f(x) ''is an element of'' O(g(x))"? In the article, "equals" is used. I think big O is the ''set of functions'' with the appropriate property. User:P3d0 13:06, 1 Aug 2003 (UTC) == Possible Correction == I noticed the statement that if f(n,m) = n^2 + m^2 + O(n+m) that this is like saying there exists N,C s.t. for all n,m >= N f(n,m) <= n^2 + m^2 + C(n+m) I would have thought that the O(n+m) is to be bounded in absolute value, i.e. |f(n,m) - n^2 - m^2| <= C|n+m| which leads to n^2 + m^2 - C|n+m| <= f(n,m) <= n^2 + m^2 + C|n+m| Is this correct? Steffan. == Little o == What does :e^x=1+x+x^2+o(x^3)\ {\rm as}\ x\rightarrow 0 where o is little o, mean? ::Essentially it means that the "missing terms" go to zero "much faster" than ''x''3 does, not just "at the same rate". Thus, for example, it could be that e^x=1+x+x^2+x^4 (not true, of course, but it would satisfy your "little-o" statement above). This works because as ''x'' goes to 0, the fraction ''x''4/''x''3 doesn't just remain finite (big-O), it actually goes to 0 (little-o). - User:Dcljr 05:14, 9 Jul 2004 (UTC) ==''O'' vs. Θ== The question is, should Wikipedia itself use Θ instead of ''O'' when both are correct, and the former is intended? (e.g. in discussing topics like the FFT and sorting.) I have a computer-science background, and I know the difference between these two...however, I also know that Θ(...) is essentially unknown outside of computer-science circles, while ''O''(...) is widely used and, informally, more-or-less understood to mean Θ. At a certain point, when usage becomes widespread enough, it ceases to be "incorrect" (it's only notation, after all). One argument is that, since Θ is so little-known, its appearance will only confuse most people...thus, one should use ''O'' as long as it is correct (even if it is weaker than necessary) except in cases where one wishes to explicitly distinguish between the two. On the other hand, one could use Θ whereever possible, making the symbol a link to this page...requiring an extra page of reading for people not familiar with it, but hoping that most people will simply guess that the symbol looks like ''O'' so it means what they expect. —User:Stevenj 07:00, 28 Nov 2003 (UTC) == Name for n^n function == I just added O(''n''''n'') to the Big O notation#Common orders of functions table, mainly because I know it's often discussed in calculus classes. But I've never been able to find a name for this function (i.e., ''n''''n'' or ''x''''x''). Does anyone have a name and source? - User:Dcljr 04:53, 9 Jul 2004 (UTC) Your edit seems to have been reverted, I don't know why (a comment could have been placed here). I think this could indeed be mentioned, but maybe we should wait for a name. I think for all that grows faster than exponential, one eventually takes the log and discusses the growth class of the latter. i.e.: * c^n = exp( (log c)·n ) = exp( linear ) * n! ~ (n/e)^n = exp( n·(log n-1) ) = "exp( quasilinear )" (sorry I can't get used to linearithmic or so) * n^n = exp ( n·log n ) = "exp( quasilinear )" , i.e. still the same ("exp-reduced") class. User:MFHUser:MFH: User talk:MFH 21:52, 21 Jun 2005 (UTC) == Italicisation == I know this is a really minor point, but can we standardize the italicization of ''O''? Is it ''O''(''n'') or O(''n'')? It's displayed both ways on this page. — User:Caesura 19:17, 20 Nov 2004 (UTC) : In [http://www.ctan.org/tex-archive/systems/knuth/tex/texbook.tex the TeX markup for the TeXbook], Knuth uses $O(n)$. That's just a big O in "math mode", but it would be rendered in italics, like a function name in TeX's math mode. The equivalent wiki <math> markup would be O(n), which is rendered as O(n), or it could be approximated by ''O(n)'', which is rendered as ''O(n)''. —User:AlanBarrett 16:46, 15 Dec 2004 (UTC) ==Big O and little o== What do the formal properties mean? In particular, what is the meaning of O(fg) = O(f)O(g)? --User:NeoUrfahraner 14:11, 18 Mar 2005 (UTC) The only possible meaning of this would be that if ''h=O(fg)'', ''f'=O(f)'', ''g'=O(g)'', then ''h = O(f' g')'', but the previous notation is indeed not completely well defined/correct. (The other way round, i.e. ''O(f) O(g) = O(fg)'' would be correct, however.) User:MFHUser:MFH: User talk:MFH 13:46, 24 May 2005 (UTC) Thank you --User:NeoUrfahraner 06:25, 27 May 2005 (UTC)

Big O notation



The Big O notation is a mathematical notation used to describe the asymptotic behavior of function (mathematics)s. More precisely, it is used to describe an asymptotic upper bound for the magnitude of a function in terms of another, usually simpler, function. In mathematics, it is usually used to characterize the residual term of a truncated infinite series, especially an asymptotic series. In computer science, it is useful in the analysis of algorithms of the computational complexity theory of algorithms. It was first introduced by Germany number theory Paul Bachmann in his 1892 book ''Analytische Zahlentheorie''. The notation was popularized in the work of another Germany number theory Edmund Landau, hence it is sometimes called a Landau notation. The big-O, standing for "order of", was originally a capital omicron; today the capital letter O is used, but never the digit 0 (number). ==Uses== There are two formally close, but noticeably different usages of this notation: infinite asymptotics and infinitesimal asymptotics. This distinction is only in application and not in principle, however—the formal definition for the "big O" is the same for both cases, only with different limits for the function argument. ===Infinite asymptotics=== Big O notation is useful when analysis of algorithms for efficiency. For example, the time (or the number of steps) it takes to complete a problem of size ''n'' might be found to be ''T''(''n'') = 4''n''2 - 2''n'' + 2. As ''n'' grows large, the ''n''2 term will come to dominate, so that all other terms can be neglected. Further, the coefficients will depend on the precise details of the implementation and the hardware it runs on, so they should also be neglected. Big O notation captures what remains: we write :T(n)\in O(n^2) and say that the algorithm has ''order of n2'' time complexity. ===Infinitesimal asymptotics=== Big O can also be used to describe the error term in an approximation to a mathematical function. For example, :e^x=1+x+x^2/2+\hbox{O}(x^3)\qquad\hbox{as}\ x\to 0 expresses the fact that the error is smaller in absolute value than some constant times ''x''3 if ''x'' is close enough to 0. == Formal definition == Suppose ''f''(''x'') and ''g''(''x'') are two functions defined on some subset of the real numbers. We say :''f''(''x'') is O(''g''(''x'')) as ''x'' \to ∞ if and only if :there exist numbers ''x''0 and ''M'' such that |''f''(''x'')| ≤ ''M'' |''g''(''x'')| for ''x'' > ''x''0. The notation can also be used to describe the behavior of ''f'' near some real number ''a'': we say :''f''(''x'') is O(''g''(''x'')) as ''x'' \to ''a'' if and only if :there exists numbers δ>0 and ''M'' such that |''f''(''x'')| ≤ ''M'' |''g''(''x'')| for |''x'' - ''a''| < δ. If ''g''(''x'') is non-zero for values of ''x'' sufficiently close to ''a'', both of these definitions can be unified using the limsup: :''f''(''x'') is O(''g''(''x'')) as ''x'' \to ''a'' if and only if :\limsup_{x\to a} \left|\frac{f(x)}{g(x)}\right| < \infty. In mathematics, both asymptotic behaviors near ∞ and near ''a'' are considered. In computational complexity theory, only asymptotics near ∞ are used; furthermore, only positive functions are considered, so the absolute value bars may be left out. ==Example== Take the polynomials: : f(x) = 6x^4 -2x^3 +5 \, : g(x) = x^4. \, We say ''f''(''x'') has order O(''g''(''x'')) or O(''x''4). From the definition of order, |''f(x)''| ≤ ''C'' |''g(x)''| for all ''x''>1, where ''C'' is a constant. Proof: : |6x^4 - 2x^3 + 5| \le 6x^4 + 2x^3 + 5 \,         where ''x'' > 1 : |6x^4 - 2x^3 + 5| \le 6x^4 + 2x^4 + 5x^4 \,     because ''x''3 < ''x''4, and so on. : |6x^4 - 2x^3 + 5| \le 13x^4 \, : |6x^4 - 2x^3 + 5| \le 13 \,|x^4 |. \, == Matters of notation == The statement "''f''(''x'') is O(''g''(''x''))" as defined above is often written as ''f''(''x'') = O(''g''(''x'')). This is a slight abuse of notation: we are not really asserting the equality of two functions. Here is an example illustrating why the equals sign is inappropriate: :O(x)=O(x^2)\ \ \mbox{but}\ \ O(x^2)\, \not=\, O(x). By this reason, some authors prefer a set notation and write ''f'' \in O(''g''), thinking of O(''g'') as the set of all functions dominated by ''g''. Furthermore, an "equation" of the form :''f''(''x'') = ''h''(''x'') + O(''g''(''x'')) is to be understood as "the difference of ''f''(''x'') and ''h''(''x'') is O(''g''(''x''))". == Common orders of functions == Here is a list of classes of functions that are commonly encountered when analyzing algorithms. All of these are as ''n'' increases to infinity. The slower-growing functions are listed first. ''c'' is an arbitrary constant. {| border="1" cellpadding="4" cellspacing="0" !notation !! name |- |O(1) || constant |- |O(\log n) || logarithmic |- |O([\log n]^c) || polylogarithmic |- |o(n) || sublinear |- |O(n) || linear |- |O(n \log n) || linearithmic, quasilinear or supralinear |- |O(n^2) || quadratic |- |O(n^c),~c > 1 || polynomial, sometimes called "algebraic" |- |O(c^n) || exponential, sometimes called "Geometric progression" |- |O(n!) || factorial |} ==Properties== If a function ''f''(''n'') can be written as a finite sum of other functions, then the fastest growing one determines the order of ''f''(''n''). For example :f(n) = 10 \log n + 5 (\log n)^3 + 7n + 3n^2 + 6n^3 = \hbox{O}(n^3)\,\!. In particular, if a function may be bounded by a polynomial in ''n'', then as ''n'' tends to ''infinity'', one may disregard ''lower-order'' terms of the polynomial. O(''n''''c'') and O(''c''''n'') are very different. The latter grows much, much faster, no matter how big the constant ''c'' is (so long as it is greater than one). A function that grows faster than any power of ''n'' is called ''superpolynomial''. One that grows slower than an exponential function of the form ''c''''n'' is called ''subexponential''. An algorithm can require time that is both superpolynomial and subexponential; examples of this include the fastest algorithms known for integer factorization. O(log ''n'') is exactly the same as O(log(''n''''c'')). The logarithms differ only by a constant factor, (since log(''n''''c'')=''c'' log ''n'') and thus the big O notation ignores that. Similarly, logs with different constant bases are equivalent. ===Product=== :O(f(n)) O(g(n)) = O(f(n)g(n)) \, ===Multiplication by a constant=== :O(K\cdot g(n)) = O(g(n)) ===Sum=== :O(f(n)) + O(g(n)) = O(\max \lbrace f(n),g(n) \rbrace) \, Other useful relations are given in section #Big O and little o below. ==Related asymptotic notations: ''O'', ''o'', Ω, ω, Θ, ''Õ''== Big O is the most commonly used asymptotic notation for comparing functions, although it is often actually an informal substitute for Θ (Theta, see below). Here, we define some related notations in terms of "big O": {| border="1" cellpadding="4" cellspacing="0" !Notation !Definition !Mathematical definition |- |f(n) \in O(g(n)) |asymptotic upper bound |\limsup_{x \to \infty} \left|\frac{f(x)}{g(x)}\right| < \infty |- |f(n) \in o(g(n)) |asymptotically negligible |\lim_{x \to \infty} \frac{f(x)}{g(x)} = 0 |- |f(n) \in \Omega(g(n)) |asymptotic lower bound | \liminf_{x \to \infty} \left|\frac{f(x)}{g(x)}\right| > 0 |- |f(n) \in \omega(g(n)) |asymptotically dominant |\lim_{x \to \infty} \frac{g(x)}{f(x)} = 0 |- |f(n) \in \Theta(g(n)) |asymptotically tight bound |f\in O(g) and g\in O(f) |} (A mnemonic for these Greek letters is that "omicron" can be read "o-micron", i.e., "o-''small''", whereas "omega" can be read "o-mega" or "o-''big''".) The relation ''f''(''n'') = o(''g''(''n'')) is read as "''f''(''n'') is little-oh of ''g''(''n'')". Intuitively, it means that ''g''(''n'') grows much faster than ''f''(''n''). Formally, it states that the limit (mathematics) of ''f''(''n'')/''g''(''n'') is zero. Aside from big-O, the notations Θ and Ω are the two most often used in computer science; the lower-case o is common in mathematics but rarer in computer science. The lower-case ω is rarely used. In casual use, O is commonly used where Θ is meant, i.e., when a tight estimate is implied. For example, one might say "heapsort is O(''n'' log ''n'') in the average case" when the intended meaning was "heapsort is Θ(''n'' log ''n'') in the average case". Both statements are true, but the latter is a stronger claim. Another notation sometimes used in computer science is Õ (read ''Soft-O''). ''f''(''n'') = Õ(''g''(''n'')) is shorthand for ''f''(''n'') = O(''g''(''n'') log''k''''g''(''n'')) for some ''k''. Essentially, it is Big-O, ignoring logarithmic factors. This notation is often used to describe a class of "nitpicking" estimates (since log''k''''n'' is always o(n) for any constant ''k''). ==Big O and little o== The following properties can be useful: * o(f) = O(f) * O(O(f)) = O(f) * o(O(f)) = o(f) and O(o(f)) = o(f) (and thus also o(o(f)) = o(f)) * O(f) + O(f) = O(f) (and thus also O(f) + o(f) = O(f)) * o(f) + o(f) = o(f) * O(f) O(g) = O(fg) * O(f) o(g) = o(fg) (and thus also o(f) o(g) = o(fg)) These formulas should be read as follows, e.g. for the last one: :If f' = O(f) and g' = o(g), then f' g' = o(fg). Warning: We do ''not'' have O(o(f)) = o(O(f)), which would mean that if f' = o(f) and g' = O(f), then h = O(f') would imply h = o(g') (which is not true). A simple counter example is given by taking g' = o (the null function), and h = f' = f^2, f(n)=1/n. Once again, here "=" does not means equality, but rather "∈", and there are counter-examples for each of the above relations if they are read from the right to the left. == Multiple variables == Big O (and little o, and Ω...) can also be used with multiple variables. For example, the statement :f(n,m) = n^2 + m^3 + \hbox{O}(n+m) \mbox{ as } n,m\to\infty asserts that there exist constants ''C'' and ''N'' such that :\forall n, m>N:f(n,m) \le n^2 + m^3 + C(n+m). To avoid ambiguity, the running variable should always be specified: the statement :f(n,m) = \hbox{O}(n^m) \mbox{ as } n,m\to\infty is quite different from :\forall m: f(n,m) = \hbox{O}(n^m) \mbox{ as } n\to\infty. ==External links== *[http://www.cprogramming.com/tutorial/computersciencetheory/algorithmicefficiency1.html Cprogramming.com: Algorithm Efficiency] An article on the Big O in C programming language Mathematical notation Mathematical analysis Asymptotic analysis th:สัญกรณ์โอใหญ่

Big o notation



#REDIRECT Big O notation


See other meanings of words starting from letter:

B

BA | BC | BD | BE | BF | BG | BH | BI | BJ | BK | BL | BM | BN | BO | BP | BR | BS | BT | BU | BW | BX | BY | BZ |

Words begining with Big_O_notation:

Big-O_notation
Big_O_Notation
Big_O_notation
Big_O_notation
Big_o_notation


These materials are based on Wikipedia and licensed under the GNU FDL



YouTube.com videos better site than Turbo Tax 2007
encyklopedia online