What are the advantages and disadvantages of array?


Advantages of Array:

  1. An array implementation allows Print to be carried out in linear time and FindKth operation in constant time, which is good as can be expected
  2. Random access is possible
  3. Implementation of list using array is easier as compared to other implementations

Disadvantages of Array:

  1. Elements of arrays are always stored in contiguous memory
    1. Inserting or deleting an element in an array may require all of its elements to be shifted
  2. The size of array is always fixed
    1. You cannot add a new element beyond the end of the array
    2. Memory for the entire array is always reserved even though you use only part of the array
    3. You must guess the expected maximum size of the list in advance

0 comments:

Feel free to contact the admin for any suggestions and help.