Docsity

Circular Linked Lists: A Circular Extension of Singly Linked Lists, Study notes of Data Structures and Algorithms

Partial preview of the text

Download Circular Linked Lists: A Circular Extension of Singly Linked Lists and more Study notes Data Structures and Algorithms in PDF only on Docsity!

Data Structures and Algorithms

LECTURE 06 – CIRCULAR LINKED LIST

  • In circular Linked List nodes are connected to form a ring
  • The list is finite and each node has a successor
  • There is no NULL reference in the list

class Node

public :

int Info;

Node* next;

Node( int el, Node *ptr = NULL)

Info = el;

next = ptr;

  • Many more operations can be included:
    • addToHead(int)
    • deleteFromHead()
    • addNode(int) -. -. class IntCLList { private : Node *tail; int Size; public : IntCLList() { tail = NULL; Size = 0; } ~IntCLList(); int isEmpty() { return (tail == NULL); } void addToTail( int ); int deleteNode( int ); void showList(); };