Linked Lists
- A linked list is a very flexible, dynamic data structure in which elements (called nodes) form a sequential list.
In a linked list, each node is allocated space as it
is added to the list. Every node in the list points to the next node in the
list. Therefore, in a linked list, every node contains the following two types
of data:
- The value of the node or any other data that corresponds to that node.
- A pointer or link to the next node in the list.
The last node in the list contains a NULL pointer to
indicate that it is the end or tail of the list. Since the memory for a node is
dynamically allocated when it is added to the list, the total number of nodes
that may be added to a list is limited only by the amount of memory available.
Types of Linked List
Following are the various types of linked list.
Following are the various types of linked list.
- Simple Linked List − Item navigation is forward only.
- Circular Linked List − Last item contains link of the first element as next and the first element has a link to the last element as previous.
- Doubly Linked List − Items can be navigated forward and backward.
No comments
Post a Comment