Forum Discussion on linked list(Week-4)

Answer

Answer

by Nahidul Islam -
Number of replies: 0

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 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 No.3

1.They use more memory than arrays because of the storage used by their pointers.

2.Nodes in a linked list must be read in order from the beginning as linked lists are inherently sequential access.

3.Nodes are stored noncontiguous, greatly increasing the time periods required to access individual elements within the list, especially with a CPU cache.

4.Difficulties arise in linked lists when it comes to reverse traversing. For instance, singly-linked lists are cumbersome to navigate backward [1] and while doubly linked lists are somewhat easier to read, memory is consumed in allocating space for a back-