Linked lists are used to store collections of data. A collection of data can be stored in array. However, an array is a sequential structure meaning that it is a group of memory elements located in contiguous locations (located next to one another in a group). You need to know how many elements there will be and you need to allocate a block of memory for them.
When you don’t know how many elements there will be, and if elements need to be inserted and deleted frequently, it is better to use a linked list. This is because each element for a linked list is created as needed and can be stored anywhere in the free memory space – the elements in the list do not have to be stored in contiguous locations.
Each element in a linked list is referred to as a node. In a simple singly linked list, each element has two fields:
Data member – contains the data (in our implementation, this is called datum)
Link member – contains the pointer to the next node (in our implementation, this is called next)