Answer the question and discuss if you have any confusion
Answer the question and discuss if you have any confusion
1. How can someone insert a node at the end of Linked List?
2. How many types of Linked List exist?
3. Mention some drawbacks of the linked list.
Answer to the question no(1)
We know that if we want to add a new node at the end of a linked list, we have to add a new node through the last insert. I also know that the address part of the last node in a linked list is null.
Now if I want to insert a new node at the end of the linked list, I first need to create a new node and insert data into the node. Then with the newly created node, you have to link the last node with the null of the existing linked list and null the address part of the new node.
Then a new node will be added as the last node at the end of the linked list and null will be assigned to the address part.
Answer to the question no (2)
There are three types of Linked List.
1.Singly Linked List
2.Doubly Linked List
3.Circular Linked List
Answer to the question no (3)
Some of the drawbacks in the linked list are mentioned below:
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.
#Answer for question:-01
If we wanna add a new node to the end of a linked list, we need to add a new node through the last insert. We know that the address portion of the last node in a linked list is drained. If we wanna add a new node to the end of the linked list, I first need to create a new node and insert data into the node. Then with the newly created node you have to associate the last node with the zero of the existing linked list and cancel the address part of the new node. A new node will then be added as a node at the end of the linked list and null will be assigned to the address section.
#Answer for question:-02
There are three common types of Linked List:
Circular Linked List.
Singly or Chain Linked List.
Doubly or Two Way Linked List.
#Answer for question:-03
Some drawbacks of linked list are mentioning:
We can't steer it from the last and exactly the first direction.
Each component requires a different amount of time to access.
This requires more space because pointers are also stored with data.
It is difficult to remove elements in a straight connected rundown but nothing.
Time Complexity Array can be randomly accessed , while the Linked list cannot be accessed Randomly.
Without requiring us to go to a certain element, we have no feel for each of the elements that preceded those elements.