LINKED LIST
A linked list is a linear/sequence form collection
of data with elements located in different placements in the memory. Each data
can refer to the next or previous data. A linked list is divided into 2
different forms these forms are a single linked list and a double linked list.
Generally the first data of a linked list is called a head and the last data is
called a tail
Characteristics of a linked list:
1. Takes the form of a linear collection of nodes
2. Does not store nodes in consecutive memory location
3. Can only be accessed only in a sequential manner
1. Takes the form of a linear collection of nodes
2. Does not store nodes in consecutive memory location
3. Can only be accessed only in a sequential manner
A.
Single linked list
In a single linked list a data can only
reference the next data or in other words can only go one way. This creates a
linked list that can not go to the previous data.
B.
Double linked list
In a double linked list a data can refer
its next or previous data, therefore creating a two way system (forward and
backwards). In this form it makes it possible to re-access the previous data.
Circular Linked List
In a circular linked list the head of the linked list can refer the tail of the linked list and the tail of the linked list can refer the head of the linked list thus creating a loop. A circular linked list does not contain a NULL node, this is due to the head and tail being able to refer each other
In a circular linked list the head of the linked list can refer the tail of the linked list and the tail of the linked list can refer the head of the linked list thus creating a loop. A circular linked list does not contain a NULL node, this is due to the head and tail being able to refer each other