Unit1 Algorithm Complexity
Unit1 Algorithm Complexity
Algorithm Complexitiy
• Space complexity: An algorithm's space complexity is the amount of
space required to solve a problem and produce an output.
• Similar to the time complexity, space complexity is also expressed in
big O notation.
For an algorithm, the space is required for the
following purposes:
• To store program instructions
• To store constant values
• To store variable values
• To track the function calls, jumping statements, etc.
• Auxiliary space: The extra space required by the algorithm, excluding
the input size, is known as an auxiliary space.
• The space complexity considers both the spaces, i.e., auxiliary space,
and space used by the input.