🔄 Circular Singly Linked List

Create a circular list and traverse to print all elements!

🎯 Problem: Create Circular Singly Linked List

Hi! I'm Teju 👋 We'll create a circular singly linked list where the last node points back to the first node.

Then we'll traverse and print all elements starting from head.

Input: N (number of nodes), followed by N values

Output: All elements printed in order (one traversal)

Key Feature: Last node → Head (circular connection)

⚙️ Creation & Traversal

To make it circular: After inserting all nodes, set last.next = head

  1. Create nodes and link them normally (next pointers)
  2. If list is not empty, connect last node → first node
  3. To print: Start from head, traverse until you return to head (use do-while)

🎮 Interactive Demo

Enter number of nodes and values to create the circular list...

Empty Circular List

📋 Printed Elements