Difference between revisions of "Comparing Algorithms - Big O"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "Big O Notation is a measure of how long or how much memory is needed to execute and algorithm. This uses the worst case scenario, so that you get the maximum time and memory u...")
 
Line 6: Line 6:
 
===== Logarithmic complexity - O(log n)=====
 
===== Logarithmic complexity - O(log n)=====
 
===== Linearithmic complexity - O(nlog n)=====
 
===== Linearithmic complexity - O(nlog n)=====
===== Polynomial complexity - O(n<superscript>k</superscript>)=====
+
===== Polynomial complexity - O(n<sup>k</sup>)=====
===== Exponential complexity - O(k<super>n</super>)=====
+
===== Exponential complexity - O(k<sup>n</sup>)=====
 
===== Factorial complexity - O(n!)=====
 
===== Factorial complexity - O(n!)=====

Revision as of 12:01, 15 May 2017

Big O Notation is a measure of how long or how much memory is needed to execute and algorithm. This uses the worst case scenario, so that you get the maximum time and memory usage. It uses n as the number of items.

Time complexities:

Constant complexity - O(1)
Linear complexity - O(n)
Logarithmic complexity - O(log n)
Linearithmic complexity - O(nlog n)
Polynomial complexity - O(nk)
Exponential complexity - O(kn)
Factorial complexity - O(n!)