ProyrammingCircular安术大术大术大大学LinkedList
Circular Linked List
COMP104CircularLinkedList/Slide2Circular Linked ListsACircular Linked List is a special type of Linked ListItsupports traversing fromtheend of thelisttothebeginningbymaking thelast nodepointbacktothehead of the listARear pointeris often used instead of a Head pointer701020一I5540Rear
COMP104 Circular Linked List / Slide 2 Circular Linked Lists A Circular Linked List is a special type of Linked List It supports traversing from the end of the list to the beginning by making the last node point back to the head of the list A Rear pointer is often used instead of a Head pointer Rear 10 20 40 55 70
COMP104CircularLinkedList/Slide3MotivationCircular linked lists are usuallysortedCircular linked lists are useful for playingvideo and sound files in“looping"modeThey are also a stepping stone toimplementing graphs, an important topicincomp171
COMP104 Circular Linked List / Slide 3 Motivation Circular linked lists are usually sorted Circular linked lists are useful for playing video and sound files in “looping” mode They are also a stepping stone to implementing graphs, an important topic in comp171
Circular Linked List Definition#include<iostream>using namespace std;struct Nodelint data;Node* next;;typedef Node* NodePtr;
#include <iostream> using namespace std; struct Node{ int data; Node* next; }; typedef Node* NodePtr; Circular Linked List Definition
COMP104CircularLinkedList/Slide5Circular Linked List OperationsinsertNode(NodePtr& Rear, int item)//add new node to ordered circular linked listdeleteNode(NodePtr& Rear, int item)//removea node from circular linked listprint(NodePtrRear)//print the Circular Linked List once
COMP104 Circular Linked List / Slide 5 Circular Linked List Operations insertNode(NodePtr& Rear, int item) //add new node to ordered circular linked list deleteNode(NodePtr& Rear, int item) //remove a node from circular linked list print(NodePtr Rear) //print the Circular Linked List once