What does the space complexity of an algorithm measure?
Correct answer A. How the memory it needs grows with the input size
Explanation
Space complexity describes the amount of working memory an algorithm requires as a function of the input size, usually expressed in Big-O notation. For example, merge sort needs O(n) extra space for its temporary array, while heap sort needs only O(1). Running time is measured separately by time complexity; code length and compile time are not part of either measure.
Answer checked How we write and check questions
Discussion