![]() |
VOOZH | about |
A linked list is a type of linear data structure individual items are not necessarily at contiguous locations. The individual items are called nodes and connected with each other using links.
We have created a Node class in which we have defined a __init__ function to initialize the node with the data passed as an argument and a reference with None because if we have only one node then there is nothing in its reference.
Example: Below is a simple example to create a singly linked list with three nodes containing integer data.
15 -> 3 -> 17 -> 90 -> None
Linked lists come in different forms depending on how nodes are connected. Each type has its own advantages and is used based on problem requirements. The main types of linked lists are:
To practice problems related to linked list, refer to this article Linked List Data Structure