An array is a collection of identical data objects or similar type of data objects stored in consecutive memory locations under a common heading or a variable name.
While a linked list is a data structure which contains a sequence of the elements where each element is linked to its next element. There are two fields in an element of a linked list. One is Data filed, and other is link filed, Data field contains the actual value to be stored and processed. Furthermore, the link field contains the address of the next data item in the linked list.
In an array, elements are stored in a consecutive manner in memory.
In a linked list, elements can be stored at any available place as the address of a node is stored in the previous node.
Insertion & deletion takes more time in an array as elements are stored in consecutive memory locations.
Insertion & deletion are fast & easy in a linked list as only value of a pointer is needed to change.
Array can be single dimensional, two dimension or multidimensional.
A linked list can be singly, doubly or circular linked list.
Comments
Post a Comment