What is the space complexity of an array of size ‘n’ ?

2025

What is the space complexity of an array of size ‘n’ ?

Answer: B. O(n)The space complexity of an array of size 'n' is O(n) because the memory required grows linearly with the number of elements. Each element in an array occupies…

  1. A.

    O(1)

  2. B.

    O(n)

  3. C.

    O(n2)

  4. D.

    O(log n)

Attempted by 647 students.

Show answer & explanation

Correct answer: B

The space complexity of an array of size 'n' is O(n) because the memory required grows linearly with the number of elements. Each element in an array occupies a fixed amount of memory (e.g., 4 bytes for an integer), so storing 'n' elements requires a total space proportional to n. This linear relationship means that as the input size increases, the memory usage scales directly with it.",

Explore the full course: Isro

Loading lesson…