List class.head NULL _class Cell { void *object; Cell *next; public:... } _class List { Cell *head; public:... }
Insert objects into a List
List class.object NULL head
List class.object.cell = new Cell(); NULL head
List class NULL.object.cell cell->next = NULL; cell->object = object; NULL head
List class.object.cell head = cell; NULL head
List class head NULL
List class NULL cell = new Cell(); object head
List class NULL cell head cell->next = NULL; cell->object = object; object NULL
List class head->next = cell; NULL cell object head
List class head->next = cell; NULL head
Find and remove an object
List class - find an object and remove it head NULL
List class - find an object and remove it NULL if (find(head->object, object)) {... head
List class - find an object and remove it NULL if (find(ptr->next->object, object)) {.ptr head
List class - find an object and remove it NULL ptr = ptr->next;.ptr head
List class - find an object and remove it NULL if (find(ptr->next->object, object)) {.ptr head
List class - find an object and remove it NULL void *object = ptr->next->object _object head.ptr
List class - find an object and remove it NULL Cell *tmp = ptr->next;.ptr _object tmp head
List class - find an object and remove it NULL ptr->next = ptr->next->next; _object tmp head.ptr
List class - find an object and remove it NULL delete tmp; _object tmp head.ptr
List class - find an object and remove it NULL return object; _object head
Doubly Linked Lists
head NULL.tail
Doubly Linked Lists head NULL.tail
Doubly Linked Lists head NULL.tail NULL
Doubly Linked Lists head NULL tail NULL
A Queue
.tail Circularly linked list
.tail Queue: insert item at rear, remove at front
.tail Queue: remove from front void *object = tail->next->object; _object
.tail Queue: remove from front tmp = tail->next; _object TempTemp tmp
.tail Queue: remove from front _tail->next = tail->next->next; _object TempTemp tmp
.tail Queue: remove from front delete tmp; _object TempTemp tmp
.tail Queue: remove from front _return object; _object TempTemp
.tail Queue: remove from front _ TempTemp
.tail Queue: insert at rear _ TempTemp
.tail Queue: insert at rear _cell = new Cell(object); TempTemp _cell NULL
.tail Queue: insert at rear _cell->next = tail->next; TempTemp _cell
.tail Queue: insert at rear _tail->next = cell; TempTemp _cell
.tail Queue: insert at rear _tail = tail->next; TempTemp _cell