Singly linked list Introduction

singly linked list

What is a Linked list?

A linked list is a linear data structure used to store a similar type of data in memory. linked lists contain a collection of nodes in a sequential manner. single linked lists may contain multiple data fields

NODE: node is block which contains its data and address of the next node

Singly linked lists are visualized above in the image, where every node points to the next node, the address of the next node is stored in the address field of the particular node. the last node contains NULL in the address field mentioned (X) in the image

The basic structure of a node

each node follows common basic code, we can store multiple data fields and least one address field is mandatory

C Python JAVA
struct node
{
    int data;           // Data 
    struct node * next; // Address 
};
class Node():
    def __init__(self, data):
        self.data = data
class Node
{
  public int data;
  public Node next;
}

Types of linked lists

Default image
Vishal Devxo
Vishal Devxo is a DevOps engineer and a Backend developer, he spends all his time for creating good tutorials with better visuals and blogging, developed some projects based on Python-Django, some hacking modules and scripts in python