Page 197 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 197
Fundamentals of Data Structures
Notes Operating system maintain queue in allocating the process to each unit by storing them in
buffer.
Queues are very efficient when we want to take out elements in the same order we have
put in inside.
11.4 Keywords
BFS: Breadth-first search (BFS) is a general technique for traversing a graph.
Dequeue: Dequeue operation is used to remove an item from the queue at the front end.
Enqueue: Enqueue operation is used to add an item to the queue at the rear end.
FIFO: FIFO (first-in, first-out) is an approach to handling program work requests from queues
or stacks so that the oldest request is handled next.
Is empty: Is empty operation checks whether the queue is empty. (If Is empty is true, then the
addition of an item is possible.
Is full: Is full operation checks whether the queue is full.
Queue: Queue is a data structure that maintain "First In First Out" (FIFO) order.
11.5 Review Questions
1. Discuss various operations carried out in a queue.
2. Explain the use of Is empty operation and Is full operation.
3. Explain the concept of Enqueue operation with example.
4. Write a program illustrating enqueue operation on a queue.
5. Describe dequeue operation with example.
6. Make distinction between enqueue and dequeue operation.
7. The dequeue operation continues until the queue is reaching its last element. Comment.
8. Discuss various applications of queues.
9. Discuss the use of queues in business applications.
10. Write a program illustrating enqueue and dequeue operation on a queue.
Answers: Self Assessment
1. First In First Out (FIFO) 2. BFS (Breadth First Search)
3. Is empty 4. Is full
5. error 6. Enqueue
7. tail 8. Dequeue
9. last 10. True
11. True 12. False
13. False 14. True
15. False
190 LOVELY PROFESSIONAL UNIVERSITY