MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / dequeue

Method dequeue

structure/queue/queuelinkedlist.go:43–57  ·  view source on GitHub ↗

dequeue it will be removed the first value into queue (First In First Out)

()

Source from the content-addressed store, hash-verified

41
42// dequeue it will be removed the first value into queue (First In First Out)
43func (ll *Queue) dequeue() any {
44 if ll.isEmpty() {
45 return -1 // if is empty return -1
46 }
47 data := ll.head.Data
48
49 ll.head = ll.head.Next
50
51 if ll.head == nil {
52 ll.tail = nil
53 }
54
55 ll.length--
56 return data
57}
58
59// isEmpty it will check our list is empty or not
60func (ll *Queue) isEmpty() bool {

Callers 1

TestQueueFunction · 0.95

Calls 1

isEmptyMethod · 0.95

Tested by 1

TestQueueFunction · 0.76