Download presentation
Presentation is loading. Please wait.
1
Queue using an array
2
.head.tail Pointers head and tail always point to the first empty slot before or after elements in the list. Thus, initially they point to the same slot, say 0.
3
.head.tail Add object to rear of list 1
4
.head.tail Add object to rear of list 1 2
5
.head.tail Add object to rear of list 1 2 3
6
.head.tail Add object to rear of list 1 2 34
7
.head.tail Remove from front 1 2 34.object
8
.head.tail Remove from front 2 34.object
9
.head.tail Add 34 5
10
.head.tail Remove 4 5 3.object
11
.head.tail Add 4 5 6
12
.head.tail Add 4 5 6 7
13
.head.tail Add 4 5 6 78
14
.tail.head Add 4 5 6 78 9
15
Queue using Circularly Linked List
16
.tail Circularly linked list
17
.tail Queue: insert item at rear, remove at front
18
.tail Queue: remove from front _object = tail->next->item; _object
19
.tail Queue: remove from front _temp = tail->next; _object TempTemp _temp
20
.tail Queue: remove from front _tail->next = tail->next->next; _object TempTemp _temp
21
.tail Queue: remove from front _delete temp; _object TempTemp _temp
22
.tail Queue: remove from front _return object; _object TempTemp
23
.tail Queue: remove from front _ TempTemp
24
.tail Queue: insert at rear _ TempTemp
25
.tail Queue: insert at rear _cell = new Cell(object); TempTemp _cell NULL
26
.tail Queue: insert at rear _cell->next = tail->next; TempTemp _cell
27
.tail Queue: insert at rear _tail->next = cell; TempTemp _cell
28
.tail Queue: insert at rear _tail = tail->next; TempTemp _cell
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.