next
and prev
pointers are the
head and tail pointers of the list. Its data member is not used.
CircularlyLinkedList
object has two data members:
int size
- Number of elements in the list.
DoublyLinkedListNode* list
- Pointer to the extra (dummy) node.
CircularlyLinkedList
uses
DoublyLinkedListNode
s.
next
pointer of the last node points to the dummy node.
prev
pointer of the first node points to the dummy node.
size >= 0
.
list != NULL
.
*list
) as node 0
and count node
size
as node -1
.
i
from 0
to size
,
next
pointer of node i
is not
NULL
.
prev
pointer of node i
is not
NULL
.
next
pointer of node i - 1
equals the
prev
pointer of node i + 1
.
i
from 1
to size - 1
(if size >= 2
),
next
pointer of node i
does not equal list
.
i
from 2
to size
(if size >= 2
),
prev
pointer of node i
does not equal list
.
prev
pointer of node 1
equals list
.
next
pointer of node size
equals list
.
circlinkedlist.h
(original),
circlinkedlist.h
(copy),
doublylinkedlistnode.h
(original),
doublylinkedlistnode.h
(copy),
ListTest.cpp
.
This page was last modified on Feb 28, 2001
URL: http://people.hsc.edu/faculty-staff/robbk/Coms262/Lectures/CircularlyLinkedLists.html