Advantages and Disadvantages of Array

First of all i might wish to tell you that it's the most question that's asked in each interview. Arrays square measure essentially a group of comparable variety of knowledge in an exceedingly contiguous memory location underneath one name.

Advantages

  • collection of comparable forms of knowledge.
  • if we would like to store the marks of all students it'll straightforward to store in array otherwise we've to store marks completely different|in several|in numerous} different location, that isn't straightforward to study.
  • we have to solely keep in mind the primary index of array.
  • used to implement different organisation like coupled lists,stack,queue, trees, graph etc.
  • 2 Dimensional array is employed to represent a matrix.

Advantages and Disadvantages of Array

DISADVANTAGES

  • Time complexness increase in insertion and deletion operation.
  • wastage of memory as a result of arrays square measure fastened in size.
  • if there's enough area gift within the memory bt not in contiguous type , during this case you'll not capable initialize your array.
  • it is impractical to extend the dimensions of the array, once you had declared the array.

Advantages:

  • Type safe
  • Can store multiple values
  • Can access values by index
  • It is helpful for storing less no of values

Disadvantages:

  • Fixed size
  • It is not helpful once we square measure handling giant set of values
  • Memory wastage

Instead of array we are able to use Generic Collections in C# i.e List wherever T is that the kind parameter and it's kind safe and therefore the size will increase dynamically once we add new values thereto.

Post a Comment for "Advantages and Disadvantages of Array"