Big O Notation (Compatibility Mode)
Big O Notation (Compatibility Mode)
Big O Notation (Compatibility Mode)
General Rules
Constant time
O(1) “Big oh of one”
X = 10 + (5 * 2);
Input size(X) is independent
doesn’t matter
doesn’t effect processing of code/algorithm
So it’s O(1)
Constant time
O(1) “Big oh of one”
X = 10 + (5 * 2);
Y = 20 – 2;
System.out.print(”x + y”);
int n = 5000;
System.out.println(“Your input is: " + n);
System.out.println(“Good stuff with: " + n);
System.out.println("And more: " + n);
In this second code the runtime would still be linear in the size of its input, n.
Polynomial is a general term which contains quadratic (n2), cubic (n3), quartic (n4),
etc. functions.