Data Structures and Algorithms - Old Questions

6. Differentiate between contiguous list and linked list with examples.

5 marks | Asked in 2068

Different between contiguous list (array) and linked list

Array (Contiguous List)

Linked list

     1.      Array is a collection of elements having same data type with common name.

 

     2.      In array, elements are stored in consecutive manner in memory.

 

     3.      Insertion & deletion takes more time in array as elements are stored in consecutive memory locations.

 

     4.      In array, memory is allocated at compile time i.e. Static Memory Allocation.

 

     5.      Array can be single dimensional, two dimension or multidimensional.

 

     6.      In array, each element is independent, no connection with previous element or with its location.

     1.      Linked list is an ordered collection of elements which are connected by links/pointers.

 

     2.      In linked list, elements can be stored at any available place as address of node is stored in previous node.

     3.      Insertion & deletion are fast & easy in linked list as only value of pointer is needed to change.

 

     4.      In linked list, memory is allocated at run time i.e. Dynamic Memory Allocation.

 

     5.      Linked list can be singlydoubly or circular linked list.

 

     6.      In Linked list, location or address of elements is stored in the link part of previous element/node