Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
    • 100+ C++ Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
      • Data Structures Solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone

Traversing in Linked List Data Structure | DSA Tutorials

YASH PAL, 11 May 20204 May 2026

Traversing a Linked List – We can traverse 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 is the link part.

Node of Linked List
Figure 1: Node of Linked List

While traversing a linked list, we need to understand the two parts of a 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 a linked list
Figure 2: Traversing a linked list

In a single linked list, we maintain a reference point to the first value of the linked list, and we name it the start variable. It’s the identity of the list, and with the help of a 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 a Linked 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 we can see in Figure 3.

Traversing a linked list
Figure 3: Traversing a linked list

So we write

p = p.link

So this refers to the next node of the list, as you see in Figure 4.

Traversing a linked list
Figure 4: Traversing a node-linked list

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

Traversing a linked list
Figure 5: Traversing the First Node 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 & Algorithms Tutorials for Beginners
Data Structures Tutorials Data StructureDSA Tutorials

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy

Practice

  • Java
  • C++
  • C

Follow US

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