It’s a process in which we determine how efficient an algorithm is. There are multiple ways to solve the same issue but the complexity analysis will likely differ, some solutions are much better than others. It’s effectively used to determine how “good” an algorithm is and whether it’s “better” than another one.
There are usually two things that we will measure, time complexity and space complexity of an algorithm
- Time Complexity
A measure of how fast an algorithm runs, time complexity is a central concept in the field of algorithms. It’s expressed using Big O notation.
- Space Complexity
A measure of how much auxiliary memory an algorithm takes up, space complexity is a central concept in the field of algorithms. It’s expressed using Big O notation.
What’s worth to add, is that different data structures are going to have different time complexity and space complexity for functions and operations that they support. The key thing is not only to figure what data structure best allows you to solve the problem but also what data structure allows you to do so with the best time/space complexity.