Singly Linked Lists are a type of data structure. In a singly linked list each node in the list stores the information of the node and a pointer to the next node in the list. It does not store any pointer reference to the previous node. It is called a singly linked list because each node only has a single link to another node. To store a single linked list, you only need to store a reference to the first node in that list. The last node has a pointer to NULL to indicate that it is the last node. Before going to discuss the operation on singly link list we will first see the basic structure of the data type and see how it could be represented in c programming. First we will see the how the node or element of singly link list is represented. See the image below:
The component of singly list node:
The component of singly list node:
info : It contains the actual information
next : This field points to the next node in the list
Now we see how the singly link list is represented. See the image below: The component of singly list are: - START pointer points to the first node of the list
- NODE : Each node have info field and next pointer to point next NODE in the list
- Last NODE of the list will point to NULL
The above structure of node is represented as below:
struct node{
int info;
struct node *next;
};
typedef struct node NODE;
Comments
Post a Comment