Forum Discussion on linked list(Week-4)

Answer

Answer

by Mazharul Islam 201-15-3283 -
Number of replies: 0


Answer to the Question Number : 1

To insert a node at the end of Linked List we have to follow the given procedure:

1) Dynamically create a new node using malloc function.

2)Set data field of new node.

3)Set next pointer of new node to NULL.

4)Traverse from head node till tail node.

5)Insert new after after tail node. Set next pointer of tail node to new node.


Answer to the Question Number : 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

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-pointer.