1.       Difference Between Singly Linked List and Circular Linked List
2.       Difference Between Array and List
3.       Difference Between Singly Linked List and Doubly Linked List


1.    Difference Between Singly Linked List and Circular Linked List 



Singly Linked List
Circular Linked List
In Singly Linked List LINK a part of last node always contains NULL value.
In Circular Linked List LINK a part of last node always contains an address of first node.
In singly Linked List if we are at middle of the list and need to access the primary node we will not go backward within the list. Thus every node within the list isn't accessible form given node.
In circular linked list last node contains an address of the primary node so every node within the list is accessible from given node.
In Singly Linked List LINK a part of last node always contains NULL value so we will easily detect end of the list.
In Circular Linked List LINK a part of last node always contains an address of first node. So we can not easily detect end of the list.


2.    Difference Between Array and List



Array
List
Array may be a collection of elements having same data type with common name.
Linked list is an ordered collection of elements which are connected by pointers.
In array, elements are often accessed randomly accessed using index. Such as a[0], a[3], etc. So array provides fast and random access.
In linked list, elements can’t be accessed randomly but are often accessed only sequentially.
In array, elements are stored in consecutive memory location.
In linked list, elements are not stored in consecutive memory location.
Insertion & Deletion takes longer in array as elements are stored in consecutive memory location.
Insertion & Deletion are fast & east in linked list as only value of pointer is required to vary .
In array, memory is allocated at compile time i.e. Static Memory Allocation.
In linked list, memory is allocated at run time i.e. Dynamic Memory Allocation.
Array are often single dimensional, two dimension or multidimensional.
Linked list can be singly, doubly or circular linked list.
In array, no pointers are used like linked list so no need of additional space in memory for pointer.
In linked list, pointers are used and for that extra memory space is needed.


3.    Difference Between Singly Linked List and Doubly Linked List


Singly Linked List
Doubly Linked List
In singly linked list each node contains two parts:
Info : Contains value
Link : Contains address of next node
In doubly linked list each node contains three parts:
Info : Contains value
RPTR : Contains address of next node
LPTR : Contains address of previous node
Occupies less memory as compared to doubly linked list.
Occupies more memory as compared to singly linked list.
In singly linked list we will traverse only in forward direction.
In doubly linked list we will traverse in forward also as backward direction.
Insertion and deletion operation are more complex in singly linked list.
Insertion and deletion operation  are performed easily in doubly linked list.

Post a Comment

Please do not enter any spam link in the comment box.

Previous Post Next Post