n
steps it will
terminateSorting cards by their respective colour
The above example is readable by a human
For a machine to understand it would require
functions and nested if
statements and control
statements
break
keyword to stop and terminate
the process when the condition is metO | Complexity | Growth Rate |
---|---|---|
O(1) | constant | fast |
O(log n) | logarithmic | |
O(n) | linear time | |
O(n log n) | log linear | |
O(n2) | quadratic | |
O(n3) | cubic | |
O(2n) | exponential | |
O(n!) | factorial | slow |