Array vs List

By | October 30, 2020
Array vs List

Array and List are two data structure used to store multiple values. The main difference between both is that the Array is a collection of Homogeneous data elements whereas the List is a Heterogeneous collection of data elements. The list can be homogeneous or non-homogeneous, it can contain different data type elements at once. The homogeneous and heterogeneous data elements are nothing just as per their name specifies that homogeneous data elements refer to the same data types that means all the elements are in the array will be of same data type and heterogeneous is its vice versa. here we discuss Array vs List.

Comparison Between Array vs List


An array is a data structure which contains homogenous elements or data type. Elements in an array stored in consecutive order. Almost, all the High-level Programming languages have the concept of Build-in array.


Syntax in different languages to define an Array

Syntax to define an Array in C++

#include <conio.h>
#include <iostream.h>
void main()
int arr[20];

In the above code, we have declared an array arr of size 20, so the indices value of this array arr would be from 0 to 19.

The syntax of Array using NumPy in Python

Python does not have the concept of the array but you can use the array in Python by importing it from its library i.e. known as NumPy.

from numpy import*
arr = array([1,2,3,4,5,6,7,8])

Array declaration in Java

class ARRAY
public static void main (String[] args)
int[] arr;
arr = new int[5];
arr[0] = 10;
arr[1] = 20;
arr[2] = 30;
arr[3] = 40;
arr[4] = 50;
for (int i = 0; i < arr.length; i++)
System.out.println("Element at index " + i +" : "+ arr[i]);

Features of Array

  • Homogeneous collection of elements
  • Total bytes = size of(Datatype) * size of array
  • The Array stored the element in an ordered sequence, that’s why an array is called linear data Structure.
  • The array has the property of finiteness this refer that every array contains a finite number of elements.
  • The elements of the array can be accessed by its relative index number
  • The array always stored in a contiguous memory location.

Operations to Perform on Arrays:

  • Accessing
  • Inserting
  • Deleting
  • Traversing

Advantages and Disadvantages of Array


  • You can store multiple data elements by the same name using an array
  • An array is very fast to use.
  • With the help of the index, you can access any element with the time complexity of O(1).
  • Other data structure can also implement by using an array such as list, stacks, queue, etc.
  • The mathematics calculation like the matrix is easy on arrays.
  • You can find the address of any element of an array for that you just need to know the address of the first element.
  • 2-D arrays used to represent matrices.


  • An array is finite.
  • The finiteness of array can lead the problem of memory wastage if you declare the size of the array more than the elements to store.
  • As the Array used to store in the contiguous memory location, if you have a memory space that is enough for your array but not in a contagious manner then you won’t be able to initialize your array.
  • The array size cannot increase and decrease during runtime.
  • The time complexity of insertion and deletion in the array is O(n).


Lists are similar to the array which is also used to store elements. The only difference is that list can store heterogeneous data elements too. You can perform many tasks on the list, however, it has some shortcoming too. But the operations performed on the list are more efficient than the arrays.

Key Features of the list:

  • List elements do not store in the contagious memory location.
  • A list is a collection of data and elements.
  • A collection of elements is simply termed as a Node.
  • Each node contains a memory address of the Successor Node.
  • The first node of the list termed as the Head Node.
  • If a list does not contain any value is termed as an Empty List.
  • The last node of the list known as Tail Node
  • The tail node pointer point to NULL, that signifies the end of the list.

The operation to be Perform on the List

  • Inserting new element
  • Deletion
  • Traversing
  • Sorting
  • Searching for a given element
  • Checking the size of the list.
  • Checking whether the list is empty or not.
  • Copying a list to another list.

Advantages and Disadvantages of List


  • List are dynamic Data Structure that is capable of adding and deleting new element during runtime.
  • The list is immune to memory wastage; in the list, you can define the size of the list according to the elements required.
  • It’s easier to perform the Insertion and Deletion operations on the list.
  • Other data structures such as Stacks and Queues can be implemented through List.


  • As compared to an array, the list requires more memory space because of the additional pointer element.
  • Traversal in the list is difficult.
  • You cannot access any element directly.

You might be also interested in:

Leave a Reply

Your email address will not be published. Required fields are marked *