Big o notation là gì

Definition:A theoretical measure of the execution of an algorithm, usually the time or memory needed, given the problem kích thước n, which is usually the number of items. Informally, saying some equation f(n) = O(g(n)) means it is less than some constant multiple of g(n). The notation is read, "f of n is big oh of g of n".

Bạn đang xem: Big o notation là gì

Formal Definition: f(n) = O(g(n)) means there are positive constants c and k, such that 0 ≤ f(n) ≤ cg(n) for all n ≥ k. The values of c & k must be fixed for the function f và must not depkết thúc on n.

*

Also known as O, asymptotic upper bound.

See alsoΩ(n), ω(n), Θ(n), , little-o notation, NP, complexity, Mã Sản Phẩm of computation.

Note:As an example, n² + 3n + 4 is O(n²), since n² + 3n + 4 10 (and many smaller values of n). Strictly speaking, 3n + 4 is O(n²), too, but big-O notation is often misused lớn mean "equal to" rather than "less than". The notion of "equal to" is expressed by Θ(n).

The importance of this measure can be seen in trying to decide whether an algorithm is adequate, but may just need a better implementation, or the algorithm will always be too slow on a big enough đầu vào. For instance, quicksort, which is O(n log n) on average, running on a small desktop computer can beat bubble sort, which is O(n²), running on a supercomputer if there are a lot of numbers khổng lồ sort. To sort 1,000,000 numbers, the quicksort takes đôi mươi,000,000 steps on average, while the bubble sort takes 1,000,000,000,000 steps! See Jon Bentley, Algorithm Design Techniques, CACM, 27(9):868, September 1984 for an example of a microcomputer running BASIC beating a supercomputer running FORTRAN.

Any measure of execution must implicitly or explicitly refer to some computation Mã Sản Phẩm. Usually this is some notion of the limiting factor. For one problem or machine, the number of floating point multiplications may be the limiting factor, while for another, it may be the number of messages passed across a network. Other measures that may be important are compares, thành công moves, disk accesses, memory used, or elapsed ("wall clock") time.

, , & use |f(n)| ≤ c|g(n)|. In Computational_complexity_theory "only positive sầu functions are considered, so the absolute value bars may be left out." (Wikipedia, "Big O notation"). This definition after .

This notation was introduced by Paul Bauchmann in his "Analytisbít Zahlentheorie" (1894). "... the O is apparently derived from the German word "Ordnung" (meaning "order")." (Ivan Panchenko, private communication, 6 September 2019) It is capital "O", not the capital Greek letter Omicron.

Author: PEB

More information

Wikipedia Big O notation. Big O is a Landau Symbol.

Xem thêm: What Is Real Time Pcr Là Gì, Những Ai Cần Làm Xét Nghiệm Rt

Donald E. Knuth, Big Omicron & Big Omega & Big Theta, SIGACT News, 8(2):18-24, April-June 1976.

Go lớn theDictionary of Algorithms & DataStructures trang chủ page.

If you have suggestions, corrections, or comments, please get in touchwith Paul Blaông xã.

Xem thêm: Nổi Mề Đay Là Gì ? Nguyên Nhân, Dấu Hiệu, Cách Chữa Trị Nổi Mề Đay Là Gì

Entry modified 6 September 2019.HTML page formatted Fri Sep 6 15:28:12 2019.

Cite this as:Paul E. Black, "big-O notation", inDictionary of Algorithms và Data Structures , Paul E. Black, ed. 6 September 2019. (accessed TODAY)Available from: https://www.ttmn.mobi.gov/dads/HTML/bigOnotation.html


Chuyên mục: Kiến Thức