1 What is a Circular Linked List? l A circular linked list is a list in which every node has a...
-
Upload
alexis-davis -
Category
Documents
-
view
221 -
download
0
description
Transcript of 1 What is a Circular Linked List? l A circular linked list is a list in which every node has a...
![Page 1: 1 What is a Circular Linked List? l A circular linked list is a list in which every node has a successor; the last element is succeeded by the first](https://reader035.fdocuments.in/reader035/viewer/2022081515/5a4d1b6e7f8b9ab0599b48c2/html5/thumbnails/1.jpg)
1
What is a Circular Linked List?A circular linked list is a list in which every node has a successor; the “last” element is succeeded by the “first” element.
‘B’ ‘C’ ‘L’ ‘T’ ‘V’ ‘Y’listData
![Page 2: 1 What is a Circular Linked List? l A circular linked list is a list in which every node has a successor; the last element is succeeded by the first](https://reader035.fdocuments.in/reader035/viewer/2022081515/5a4d1b6e7f8b9ab0599b48c2/html5/thumbnails/2.jpg)
2
‘A’ ‘C’ ‘F’ ‘T’ ‘Z’
What is a Doubly Linked List?
listData
A doubly linked list is a list in which each node is linked to both its successor and its predecessor.
![Page 3: 1 What is a Circular Linked List? l A circular linked list is a list in which every node has a successor; the last element is succeeded by the first](https://reader035.fdocuments.in/reader035/viewer/2022081515/5a4d1b6e7f8b9ab0599b48c2/html5/thumbnails/3.jpg)
3
Each node contains two pointers class NodeType { public: ItemType info; // Data member NodeType* back; // Pointer to predecessor NodeType* next; // Pointer to successor};
. back . info . next
3000 ‘A’ NULL
![Page 4: 1 What is a Circular Linked List? l A circular linked list is a list in which every node has a successor; the last element is succeeded by the first](https://reader035.fdocuments.in/reader035/viewer/2022081515/5a4d1b6e7f8b9ab0599b48c2/html5/thumbnails/4.jpg)
4
What are Header and Trailer Nodes?
listData INT_MIN 5 8 13 INT_MAX
A Header Node is a node at the beginning of a list that contains a key value smaller than any possible key.
A Trailer Node is a node at the end of a list that contains a key larger than any possible key.
Both header and trailer are placeholding nodes used to simplify list processing.