Enqueuing an item in the queue
The enqueue operation adds a data item to the end of the queue and is implemented by adding the data item at the end of the internal array using the backIndex. Addition only happens after ensuring that we do not exceed the capacity of the queue after this operation. The implementation is quite straightforward, though there are certain cases that we need to consider.
1. Queue is full
Since the queue is full, we cannot add more data without removing some items. We will return false as this operation cannot be done
Liking the course? Check our discounted plans to continue learning.