Complexity of an algorithm is measure of amount of time and/or space required by an algorithm for an input of given size n.
There are two main complexity measures of the efficiency of algorithm:
- Time Complexity
- Space Complexity
Time complexity is the function describing the amount of time an algorithm takes in terms of the amount of input to the algorithm. Time can mean the number of memory accesses performed, the number of comparisons between integers, the number of times some inner loop is executed, or some other natural unit related to the amount of real time the algorithm will take.
Space complexity is a function describing the amount of memory (space) an algorithm takes in terms of the amount of input to the algorithm.
No comments:
Post a Comment