Suppose we have the following list of characters: (B, L, A, P, T, A) a) Illustrate and describe briefly a singly linked list representation of the characters above. b) Illustrate and describe briefly a doubly linked list representation of the characters above.
Singly linked list is a data structure that is used to store data in entities called 'node'. Each node is connected with each other. A node has two fields:
1. Data filed: It contains data/information like characters here
2. Address or next field: it contains address of the next node
In singly linked list, there is only one connection that is connection to the next node.
Doubly linked list is same as singly linked list but it has three fields:
1. Data filed: It contains data/information like characters here
2. Address or next field: it contains address of the next node
3. Previous address filed: it contains address of the previous field
The difference between singly linked list and the doubly linked list is that singly linked list has address of the next node only(only one link) while doubly linked list has address of the next node as well as previous nodes (two links)
Both singly and doubly linked list contains a HEAD pointer which always points to the first node of the list and the last node of the list contains NULL.
Step by step
Solved in 5 steps with 2 images