Linked List – Linked List consists of nodes attached to each other where every node holds the address of the other node. Show We can create two types of linear linked List
What is a Singly Linked List?A Singly Linked List consists of Nodes attached to each other where each node has two members – ‘data’ and ‘next’ .’data’ is the data of the nodes and ‘next’ stores the address of the next node. Here is the diagrammatic representation of singly Linked List Advantages of Singly Linked List
Disadvantages of Singly Linked List
What is a Doubly Linked List?Doubly Linked List consists of Nodes attached to each other where each node has three members – ‘data’, ‘prev’ and ‘next’ .’data’ is the data of the nodes,’ prev’ stores the address of the previous node, and ‘next’ stores the address of the next node. Here is the diagrammatic representation of Doubly Linked List Advantages of Doubly Linked List
Disadvantages of Doubly Linked List
Now let us analyze the difference between Singly Linked List and Doubly Linked List.
Some Important Questions on LinkedList:
Que- Advantage and Disadvantage of singly Linked list and Doubly Linked list
*ADVANTAGE :- 1) Insertions and Deletions can be done easily. 2) It does not need movement of elements for insertion and deletion. 3) It space is not wasted as we can get space according to our requirements. 4) Its size is not fixed. 5) It can be extended or reduced according to requirements. 6) Elements may or may not be stored in consecutive memory available,even then we can store the data in computer. 7) It is less expensive. *DISADVANTAGE :- 1) It requires more space as pointers are also stored with information. 2) Different amount of time is required to access each element. 3) If we have to go to a particular element then we have to go through all those elements that come before that element. 4) we can not traverse it from last & only from the beginning. 5) It is not easy to sort the elements stored in the linear linked list. ----------------------------------------------------------------------------------------------------------- DOUBLY LINKED LIST *ADVANTAGE :- 1) We can traverse in both direction i.e from starting to end & as well as from end to starting. 2) It is easy to reverse the linked list. 3) If we are at a node,the we can go at any node.But in linked list,it is not possible to reach the previous node. *DISADVANTAGE :- 1) It requires more space per space per node because extra field is required for pointer to previous node. 20 Insertion and Deletion take more time than linear linked list because more pointer operations are required than linear linked list.
There are many data structures like arrays, linked lists, etc. Each sort of arrangement has its strengths and weaknesses. For these reasons, it’s important to know the benefits and drawbacks of different data structures when it comes to designing, optimizing, and scaling programs. In this article, we will discuss the advantages and disadvantages of the linked list. Linked List: A Linked list is a dynamic arrangement that contains a “link” to the structure containing the subsequent items. It’s a set of structures ordered not by their physical placement in memory (like an array) but by logical links that are stored as a part of the info within the structure itself. A linked list is another way to collect similar data. However, unlike an array, elements during a linked list aren’t in consecutive memory locations. A linked list consists of nodes that are connected with one another using pointers. The figure illustrates a linked list. Types Of Linked List:
Advantages Of Linked List:
Disadvantages Of Linked List:
Article Tags : Practice Tags : |