Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
    • Cybersecurity
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone
Programmingoneonone

Traversing in Linked List | Data Structure

YASH PAL, 11 May 202015 August 2025

Traversing in Linked List – We can traverse in a linked list using the links of every node. As we know the single linked list is made up of a node where each node has two parts. one is the info part and the other one is link part.

Traversing in linked list

While traversing a linked list we need to understand about the two part of linked list

Info part of the linked list – The info part contains the actual data to be stored on the list.

The linked part of the list – link is a reference to the next value of the list.

Traversing in linked list

In a single linked list, we maintain a reference point to the first value of the linked list and we named it to start variable.

It’s the identity of the list and with the only help of start variable, we can access the whole list following the links of each node. if a node contains no value or None. this means the linked list ended up there. in the above image. the linked part of the node that contains the value None is the last node of the list. and for an empty linked list, the start variable contains the value None.

Traversing into list

Traversing means we can visit each node in a list at a single time. to traverse into a list we need to know how we can move forward using the link of the list. suppose we have a reference to the node as you see in the image.

traversing into linked list

so we write

p = p.link

So this refers to the next node of the list as you see in the image.

Next node of linked list

Now to traverse into the linked list we need to refer to the first node of the list as you see in the image.

First node of linked list

So we point the variable p to the first node of the list using the code.

self.start = None

Now using this code we can traverse the whole list.

def display_list(self):
    if self.start is None:
        print("List is empty")
        return    else:
        print("List is :   ")
        p = self.start
        while p is not None:
            print(p.info, " ", end=' ')
            p = p.link
        print()
Data Structures Tutorials Data Structure

Post navigation

Previous post
Next post

Are you a student and stuck with your career or worried about real-time things, and don't know how to manage your learning phase? Which profession to choose? and how to learn new things according to your goal, and land a dream job. Then this might help to you.

Hi My name is YASH PAL, founder of this Blog and a Senior Software engineer with 5+ years of Industry experience. I personally helped 40+ students to make a clear goal in their professional lives. Just book a one-on-one personal call with me for 30 minutes for 300 Rupees. Ask all your doubts and questions related to your career to set a clear roadmap for your professional life.

Book session - https://wa.me/qr/JQ2LAS7AASE2M1

Pages

  • About US
  • Contact US
  • Privacy Policy

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes