Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Advantages and disadvantages of Array

Advantages:-

1. Code Optimization: we can retrieve or sort the data efficiently.


2. Random access: We can get any data located at an index position.
3. Useful in data structures: - we can implement data structures like
stacks, queues, linked lists, trees, graphs, etc. in Array.
4. Arrays can sort multiple elements at a time.

Disadvantages:-

1. Size Limit: We can store only the fixed size of elements in the array. It
doesn’t grow its size at runtime. The array is static structure. It means
array size is always fixed, so we cannot increase or decrease memory
allocation.
2. We have to declare Size of an array in advance. However, we may not
know what size we need at the time of array declaration.

You might also like