PowerPoint Presentation
1
Queues
Data Structures: A Pseudocode Approach with C
2
Data Structures: A Pseudocode Approach with C
3
4
First In First Out data structure.
Restricted linear list:
Insert – restricted insert at the end
Delete – restricted delete from the beginning
5
First In First Out data structure.
Restricted linear list:
Insert – restricted INSERT at the end
Delete – restricted delete from the beginning
6
First In First Out data structure.
Restricted linear list:
Insert – restricted INSERT at the end
Delete – restricted delete from the beginning
front
rear
7
First In First Out data structure.
Restricted linear list:
Insert – restricted INSERT at the end
Delete – restricted delete from the beginning
front
rear
8
First In First Out data structure.
Restricted linear list:
Insert – restricted INSERT at the end
Delete – restricted delete from the beginning
front
rear
9
First In First Out data structure.
Restricted linear list:
Insert – restricted insert at the end
Delete – restricted delete from the beginning
front
rear
10
First In First Out data structure.
Restricted linear list:
Insert – restricted insert at the end
Delete – restricted DELETE from the beginning
front
rear
11
First In First Out data structure.
Restricted linear list:
Insert – restricted INSERT at the end
Delete – restricted delete from the beginning
front
rear
12
First In First Out data structure.
Restricted linear list:
Insert – restricted insert at the end
Delete – restricted DELETE from the beginning
front
rear
13
First In First Out data structure.
Restricted linear list:
Insert – restricted insert at the end
Delete – restricted delete from the beginning
front
rear
14
Queue Operations
1. Create queue
2. Enqueue
3. Dequeue
4. Queue front
5. Queue rear
6. Empty queue
7. Full queue
8. Queue count
9. Destroy queue
15
Queue Operations
1. Create queue
2. Enqueue
3. Dequeue
4. Queue front
5. Queue rear
6. Empty queue
7. Full queue
8. Queue count
9. Destroy queue
Basic queue operations (4):
16
Queue Operations
1. Create queue
2. Enqueue
3. Dequeue
4. Queue front
5. Queue rear
6. Empty queue
7. Full queue
8. Queue count
9. Destroy queue
Basic Queue Operations
17
Queue Operations
1. Create queue
2. Enqueue
3. Dequeue
4. Queue front
5. Queue rear
6. Empty queue
7. Full queue
8. Queue count
9. Destroy queue
Most often used queue operations (4):
18
Queue Operations
1. Create queue
2. Enqueue
3. Dequeue
4. Queue front
5. Queue rear
6. Empty queue
7. Full queue
8. Queue count
9. Destroy queue
Most Often Used Queue Operations
Data Structures: A Pseudocode Approach with C
19
Data Structures: A Pseudocode Approach with C
20
Data Structures: A Pseudocode Approach with C
21
Data Structures: A Pseudocode Approach with C
22
Data Structures: A Pseudocode Approach with C
23
Data Structures: A Pseudocode Approach with C
24
(Continued)
25
Array
Queue Implementations
Linked List
26
Array Implementation of Queues
10
30
20
0
2
3
1
4
5
6
7
8
9
queue
27
rear
10
30
20
0
2
3
1
4
5
6
7
8
9
queue
front
Array Implementation of Queues
28
Enqueue 40
10
30
20
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
29
10
30
20
40
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
30
Enqueue 25
10
30
20
40
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
31
Enqueue 25
10
30
20
40
rear = rear + 1
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
32
Enqueue 25
10
30
20
40
rear = rear + 1
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
33
Enqueue 25
10
30
20
40
25
rear = rear + 1
queue[rear] = dataIn
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
34
10
30
20
40
25
if ( queue not full )
rear = rear + 1
queue[rear] = dataIn
else
queue is in OVERFLOW state
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
35
10
30
20
40
25
Dequeue
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
36
30
20
40
25
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
37
30
20
40
25
Dequeue
if ( queue not empty )
dataOut = queue[front]
front = front + 1
else
queue is in UNDERFLOW state
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
38
30
40
25
0
2
3
1
4
5
6
7
8
9
queue
rear
front
Array Implementation of Queues
Data Structures: A Pseudocode Approach with C
39
Figure 5-15
Data Structures: A Pseudocode Approach with C
40
Figure 5-16
Data Structures: A Pseudocode Approach with C
41
Figure 5-17
Data Structures: A Pseudocode Approach with C
42
Data Structures: A Pseudocode Approach with C
43
Data Structures: A Pseudocode Approach with C
44
Data Structures: A Pseudocode Approach with C
45
(Continued)
Data Structures: A Pseudocode Approach with C
46
Data Structures: A Pseudocode Approach with C
47
Data Structures: A Pseudocode Approach with C
48
Data Structures: A Pseudocode Approach with C
49
Data Structures: A Pseudocode Approach with C
50
Data Structures: A Pseudocode Approach with C
51
52
Queue ADTs
53
QUEUE – Physical Representation
queue
rear
count
3
front
20
30
10
54
QUEUE ADT- Physical Representation
queue
rear
count
3
front
10
20
30
/docProps/thumbnail.jpeg