Security Encyclopedia

Time Complexity

Time Complexity refers to the amount of time an algorithm takes to run as a function of the length of the input.

Like space complexity, which is a measure of the memory or space an algorithm takes to run as a function of the length of the input, time complexity is a way to evaluate the performance of an algorithm. 

In cases where there is more than one way to solve a problem or achieve a result, measures of speed are often important to those who are proposing or implementing solutions. All other things being equal, a solution that is more resource-intensive with respect to the amount of time needed is less desirable than their more efficient (here, faster) counterparts.  

Time complexity is sometimes conflated with running time, however they are not the same. Time complexity is a quality of an algorithm, and it is the running time of a computational problem. Running time, not to be confused with time complexity, is simply how long a computer program takes to run.


“After technical teams select programs that provide the same outcome for the outcome needed, they typically test its performance vis a vis the other programs. Time complexity, or the amount of time a program needs to run its operation with a realistic sample input, is one performance indicator at the technical teams’ disposal.”