Big o notation
Big O notation is a mathematical notation that describes the limiting behavior of a function when the argument tends towards a particular value or infinity. It is a member of a family of notations invented by Paul Bachmann, Edmund Landau, and others, collectively called Bachmann–Landau notation or asymptotic notation.
Overview[edit | edit source]
Big O notation characterizes functions according to their growth rates: different functions with the same growth rate may be represented using the same O notation. The letter "O" is used because the growth rate of a function is also referred to as the order of the function. A description of a function in terms of big O notation usually only provides an upper bound on the absolute value of the function.
Definition[edit | edit source]
Formally, let f and g be two functions defined on some subset of the real numbers. One writes
- f(x) = O(g(x)) as x → ∞
if and only if there is a positive constant M such that for all sufficiently large values of x, the absolute value of f(x) is at most M multiplied by the absolute value of g(x). That is,
- |f(x)| ≤ M |g(x)| for all x > x₀.
In many contexts, the assumption that x → ∞ is omitted and it is taken as understood that the behavior of the function is being described as x grows arbitrarily large.
Usage[edit | edit source]
Big O notation is used in many areas of computer science, particularly in algorithm analysis, computational complexity theory, and computer science. It provides a useful way to express the time complexity or space complexity of an algorithm, allowing the performance of different algorithms to be compared.
Examples[edit | edit source]
1. The function f(x) = 6x^4 - 2x^3 + 5, and g(x) = x^4 can be described by f(x) = O(x^4). 2. The time complexity of searching an element in a balanced search tree is O(log n) where n is the number of elements in the tree.
Related Concepts[edit | edit source]
Big O notation is often used in conjunction with other notations such as Big Omega notation (Ω), which provides a lower bound on the growth rate of a function, and Big Theta notation (Θ), which provides a tight bound on the growth rate.
See Also[edit | edit source]
Search WikiMD
Ad.Tired of being Overweight? Try W8MD's physician weight loss program.
Semaglutide (Ozempic / Wegovy and Tirzepatide (Mounjaro / Zepbound) available.
Advertise on WikiMD
WikiMD's Wellness Encyclopedia |
Let Food Be Thy Medicine Medicine Thy Food - Hippocrates |
Translate this page: - East Asian
中文,
日本,
한국어,
South Asian
हिन्दी,
தமிழ்,
తెలుగు,
Urdu,
ಕನ್ನಡ,
Southeast Asian
Indonesian,
Vietnamese,
Thai,
မြန်မာဘာသာ,
বাংলা
European
español,
Deutsch,
français,
Greek,
português do Brasil,
polski,
română,
русский,
Nederlands,
norsk,
svenska,
suomi,
Italian
Middle Eastern & African
عربى,
Turkish,
Persian,
Hebrew,
Afrikaans,
isiZulu,
Kiswahili,
Other
Bulgarian,
Hungarian,
Czech,
Swedish,
മലയാളം,
मराठी,
ਪੰਜਾਬੀ,
ગુજરાતી,
Portuguese,
Ukrainian
Medical Disclaimer: WikiMD is not a substitute for professional medical advice. The information on WikiMD is provided as an information resource only, may be incorrect, outdated or misleading, and is not to be used or relied on for any diagnostic or treatment purposes. Please consult your health care provider before making any healthcare decisions or for guidance about a specific medical condition. WikiMD expressly disclaims responsibility, and shall have no liability, for any damages, loss, injury, or liability whatsoever suffered as a result of your reliance on the information contained in this site. By visiting this site you agree to the foregoing terms and conditions, which may from time to time be changed or supplemented by WikiMD. If you do not agree to the foregoing terms and conditions, you should not enter or use this site. See full disclaimer.
Credits:Most images are courtesy of Wikimedia commons, and templates Wikipedia, licensed under CC BY SA or similar.
Contributors: Prab R. Tumpati, MD