Practice mode Data Structures

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.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.