Linked Lists
Linked list in simple terms is a linear collection of data elements. These data elements are called 'Nodes' . Linked list can be used to implement other data structures. Thus, it acts as a building block to various other data structures like stacks, queues and their variations. A linked list can be perceived a train of various nodes where each node contains different data elements and a pointer to the next node.
Representation of Linked List :-
Representation of Linked List :-
Every node contains two parts , i) data ii) pointer to next node. In this, data can be anything like a string, integer, array of integers, structure or even collection of all these. The next pointer points to the next node of same data-type hence it is called self-referential data type. Last node of the linked list points to a special value called NULL. This is represented using x.
Linked lists contain a pointer variable START which stores the address of first node of the Linked List. We can traverse entire linked list using a single pointer variable START. START points to first node , next of first node points to the next node and so on until the next of last node pointing to NULL.
If START is empty then we can say that linked list is not created.
Linked List can be Implemented in C Using :-
Linked lists contain a pointer variable START which stores the address of first node of the Linked List. We can traverse entire linked list using a single pointer variable START. START points to first node , next of first node points to the next node and so on until the next of last node pointing to NULL.
If START is empty then we can say that linked list is not created.
Linked List can be Implemented in C Using :-
struct Node
{
int data;
struct Node *next;
};
{
int data;
struct Node *next;
};