Team About ๐Ÿ“š Notes ๐Ÿ“ƒ Paper 02s ๐Ÿฆ Question Banks โœ๏ธ Quizzes ๐Ÿ—„๏ธ Flashcards โš™๏ธ Tools T.J.I. ๐Ÿชผ ๐Ÿ”Ž SEARCH
Blog Contact Us!

Queues (ADTs)

This addresses M1S02,3 of the CS Unit 2 syllabus

Author:Author ImageTristan Seetaram

Edu Level: Unit2

Date: Aug 6 2026 - 8:48 PM

โฑ๏ธRead Time:



QUEUES

QUEUES

  • A queue is a linear data structure similar to a line in a store
  • Follows FIFO (First In First Out)
  • New elements are inserted at the rear
  • Elements are removed from the front
  • Both ends are used โ€” front for deletion and rear for insertion

ย 

FEATURES OF QUEUE

  • Linear structure
  • Operates on FIFO principle
  • Maintains two pointers: front โ†’ points to first element, rear โ†’ points to last element
  • Overflow occurs when queue is full
  • Underflow occurs when queue is empty

ย 

TYPES OF QUEUES

  • Simple Queue โ†’ standard FIFO structure
  • Circular Queue โ†’ connects rear to front to reuse empty space
  • Priority Queue โ†’ elements served by priority rather than order


IMPLEMENTATION

  • Can be implemented using arrays or linked lists
  • Array implementation uses static memory
  • Linked list implementation uses dynamic memory
  • Head pointer (front) marks the start of the queue
  • Tail pointer (rear) marks the end of the queue

ย 

BASIC OPERATIONS

  • enqueue() โ†’ adds (stores) an item at the rear
  • dequeue() โ†’ removes (accesses) an item from the front
  • peek() โ†’ returns the front element without removing it
  • isFull() โ†’ checks if queue is full
  • isEmpty() โ†’ checks if queue is empty

ย 

ENQUEUE PROCESS

  • Check if queue is full
  • If full โ†’ return Overflow
  • If not full โ†’ increment rear pointer
  • Insert data at position pointed to by rear
  • Return success

ย 

DEQUEUE PROCESS

  • Check if queue is empty
  • If empty โ†’ return Underflow
  • If not empty โ†’ access data at front
  • Increment front pointer to next position
  • Return success

ย 

DECLARATION VARIABLES

  • queue[MAX] โ†’ defines maximum capacity
  • front โ†’ index of first element
  • rear โ†’ index of last element
  • MAX โ†’ constant for queue size

ย 

CHARACTERISTICS

  • Insertion always occurs at rear
  • Deletion always occurs at front
  • Traversal happens from front to rear
  • Queue size is limited in static implementation

ย 

ADVANTAGES

  • Maintains order of processing
  • Useful for scheduling and buffering

ย 

DISADVANTAGES

  • Static queues waste memory after repeated insertions and deletions
  • Access limited to front and rear

If you are still unsure about how queues work, please watch these videos:


Remember all notes are more accurate to the CAPE syllabus than videos

About Tristan Seetaram

Loading bio... Read More

Mode