MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / IsEmpty

Method IsEmpty

structure/circularqueue/circularqueuearray.go:78–80  ·  view source on GitHub ↗

IsEmpty checks if the queue is empty.

()

Source from the content-addressed store, hash-verified

76
77// IsEmpty checks if the queue is empty.
78func (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.

Callers 4

EnqueueMethod · 0.95
DequeueMethod · 0.95
PeekMethod · 0.95
TestCircularQueueFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestCircularQueueFunction · 0.36