What are the strengths and limitations of arrays? What considerations go into choosing an array over another data structure, or vice-versa?


closed as unclear what you're asking by David Richerby, Evil, hengxin, xskxzr, Thinh D. Nguyen Oct 19 '18 at 15:35

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ The question is too broad. Could you list that you want to compare? $\endgroup$ – kelalaka Oct 16 '18 at 11:58

Here a simple answer is;

  • Arrays

    • allow fast random access in $\mathcal{O}(1)$ to their elements since and they are sequential in memory.
    • $\mathcal{O}(1)$ time write or update an element
    • if not created in heap memory size is very limited.
    • The size is fixed.
  • Vectors

    • Access and write is similar to array
    • The size not fixed. When capacity is full, extended.

Not the answer you're looking for? Browse other questions tagged or ask your own question.