Queue Implementation

VBA Implementation Simple Linear Queue (no size restriction)

This is an implementation of a simple queue with no size restriction. It will eat away at the available memory since items are never actually removed from the dynamic array.

Required variables

 

 

Initialising the queue

Enqueue

Dequeue

VBA Implementation Circular Queue

Notice that with a circular queue, when we enqueue a new data item, we need to test for queue overflow. We also need to test to see if the rear has reached the maximum capacity of the queue. If so, the new rear becomes the first element of the queue. Similar checks are performed when we dequeue an item.

Required variables

Initialising the queue

Enqueue

Dequeue