IsEmpty checks if the queue is empty.
()
| 76 | |
| 77 | // IsEmpty checks if the queue is empty. |
| 78 | func (cq *CircularQueue[T]) IsEmpty() bool { |
| 79 | return cq.front == -1 && cq.rear == -1 |
| 80 | } |
| 81 | |
| 82 | // Peek returns the item at the front of the queue without removing it. |
| 83 | // Returns an error if the queue is empty. |
no outgoing calls