MCS-208 · Unit 5

Queues

8 sections

Block 2 · Unit 5Queues74 min · 8 sections

Unit 5Queues

Follows IGNOU MCS-208, Unit 5

A queue is a list in which items join at one end and leave from the other, so the first item in is the first item out. Queues are everywhere in computing: print jobs waiting for a printer, processes waiting for the CPU, packets waiting in a network router, and requests waiting at a web server. This unit defines the queue ADT and implements it with arrays and linked lists, then studies its important variants: multiple queues in one array, circular queues, priority queues and double-ended queues (deques).

In this unit you will learn to

  • explain the queue ADT and the FIFO rule, and trace add and delete operations;
  • implement a queue with an array and with a linked list, and explain why a plain array queue wastes space;
  • store several queues in one array;
  • implement a circular queue and tell a full circular queue from an empty one;
  • build a circular queue from a circular linked list with one pointer;
  • explain priority queues and implement one with a sorted list;
  • implement a deque (double-ended queue) with an array and with a doubly linked list.

Sections in this unit

  1. 5.1The Queue ADTWhat a queue is, the FIFO rule, front and rear, the queue operations and where queues are used in computing.8 min
  2. 5.2Queue Implementation Using ArraysA linear array queue with front and rear indices, the add and delete algorithms, why it wastes space, and a corrected Program 5.1.9 min
  3. 5.3Queue Implementation Using Linked ListsA linked queue with front and rear pointers, O(1) add and delete, the empty-queue special cases, and corrected Programs 5.2 and 5.3.9 min
  4. 5.4Multiple Queues in One ArrayKeeping several queues in segments of one array with separate front and rear indices, and corrected Programs 5.4 and 5.5.7 min
  5. 5.5Circular Queues Using ArraysWrapping a queue around the end of an array with the modulo operator, telling full from empty, and a corrected Program 5.6.7 min
  6. 5.6Circular Queues Using Linked ListsA queue stored in a circular linked list with a single rear pointer, its add and delete operations, and the problems of Program 5.7.10 min
  7. 5.7Priority QueuesQueues that serve the most urgent item first, their ADT and applications, and implementations with sorted lists, unsorted arrays and heaps.9 min
  8. 5.8Deques (Double-Ended Queues)Deques that allow insertion and deletion at both ends, input- and output-restricted deques, and array and doubly linked implementations.15 min
↑ ↓ move↵ openTab switch type