The array is a Data structure that contains a collection of elements of the same type under a single variable name. Elements are stored under continuous memory


  • It stores the elements in insertion order
  • Elements are ordered on the insertion order
  • Elements get using the index, Starting index=0, last element index = length-1
  • Elements are not sorted
  • Array contains the fixed size in length

Array Types:

There are multiple types of arrays.

  • One-Dimensional Array. It contains a sequence of elements in a single row. Also called as Linear Array

  • Two-dimensional Arrays

    It is an array of array, Containing rows and columns. Matrix is a 2-dimensional array. Multi-Dimensional Arrays: It is an array of nested arrays. It can be 3x3 or nxn arrays.

Arrays Operations

Arra contains the following basic operations

  • Insert an element
  • Delete an element
  • Search an array
  • Sort An array
  • Iterate each element

Array advantages

  • It stores the elements in insertion order, unordered
  • It uses as a basic data structure to implement other data structures, Array lists, Linked List
  • Accessing elements is 0(1) and faster

Array disadvantages

  • Arrays are static, so Size can not be modified
  • If the array is defined with fixed size n, the number of elements stored is n-1, and memory waste exists.
  • It stores data of the same type

Array time complexity for operations

Time complexity is the same for Best, average, The Worst Case

OperationTime complexity
Get ElementsO(1)
Insert an ElementO(n)
Delete an ElementO(n)
Search an ElementO(n)
Sort an ElementsO(n)