Computer Science, asked by sabharwal1120, 9 months ago

What are the advantages and disadvantages of a single dimensional array?.

Explain it with proper examples.​

Answers

Answered by Anonymous
11

\huge\mathfrak\pink{Answer!}

Advantages of Arrays

In arrays, the elements can be accessed randomly by using the index number. Arrays allocate memory in contiguous memory locations for all its elements. Hence there is no chance of extra memory being allocated in case of arrays. This avoids memory overflow or shortage of memory in arrays.

Disadvantages of Arrays

  • The number of elements to be stored in an array should be known in advance.

  • An array is a static structure (which means the array is of fixed size).

  • Insertion and deletion are quite difficult in an array as the elements are stored in consecutive memory locations and the shifting operation is costly.

Hope it helps you

ItzRiya

Similar questions