C Programming and Data Structures: Unit III: a. Linear Data Structures - List

Difference between Array and Linked Listed

The comparison between linked list and arrays is as shown below

Difference between Array and Linked Listed

The comparison between linked list and arrays is as shown below -


 

Ex. 3.6.1 Compare linked list with arrays with reference to the following aspects :

i) Accessing any element randomly

ii) Insertion and deletion of an element

iii) Utilization of computer memory.

Sol. i) Accessing any element randomly: Using array, any element can be accessed easily.

a) It takes constant time.

b) In linked list, we can access elements in sequence. So it is very difficult and time consuming to access a element randomly.

ii) Insertion and deletion of an element :

a) Insertion and deletion of elements is time consuming.

b) In linked list, we can insert and delete elements easily and it is less time consuming.

iii) Utilization of computer memory:

a) Array requires contiguous memory. First we have to declare array and compiler allocates memory at declaration.

b) If we utilize less memory than allocated, then unutilized memory is unnecessarily reserved for array. It can't be used by other programs. il sewed noensgroo

c) If we want to add more elements than the actual size of array, it is not possible.

d) In linked list, memory is utilized efficiently. Memory is not pre-allocated like static data structure. Memory is allocated as per the need. Memory is deallocated when it is no longer needed.


C Programming and Data Structures: Unit III: a. Linear Data Structures - List : Tag: : - Difference between Array and Linked Listed