BASIC OPERATIONS:
The most basic queue operations in the data structure are the following
- enqueue() - Adds an element at the beginning of the queue. If the queue is full, then it is an overflow.
- dequeue() - Deletes an element at the end of the queue. If the queue is empty, then it is an underflow.
enqueue()
- Check if the queue is full.
- If the queue is full, then print "Queue overflow".
- Else increment REAR by 1.
- Assign QUEUE [ REAR ] = ELEMENT.
dequeue()
- Check if the queue is empty.
- If the queue is empty, the print "Queue underflow".
- Copy the element at the front of the queue to some temporary variable, TEMP = QUEUE[ FRONT ].
- Increment FRONT by 1.
- Print temp and delete it.
0 Comments
Doubts? Please let our team know So that we can serve you better.