48.6k views
0 votes
What is meant by a dynamic array? What is the advantage of a dynamic array over a regular array?

User Marielena
by
5.0k points

1 Answer

3 votes

Answer & Explanation:

A dynamic array is an array that grow (item can be added) and shrink (item can be removed) as required and it does not have limit to it structural size except for the size of it main memory.

one obvious advantage of a dynamic array over a regular array is that, in situations where the size of the data structure is not known during creation, a dynamic array will come in handy over a regular one.

Another advantage I can think of, is the efficiency in terms of memory usage i.e. almost no memory overhead.

User Pablo NotPicasso
by
5.5k points