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

Method Dequeue

structure/queue/queuelinklistwithlist.go:30–40  ·  view source on GitHub ↗

Dequeue will be removed the first value that input (First In First Out - FIFO)

()

Source from the content-addressed store, hash-verified

28
29// Dequeue will be removed the first value that input (First In First Out - FIFO)
30func (lq *LQueue) Dequeue() error {
31
32 if !lq.Empty() {
33 element := lq.queue.Front()
34 lq.queue.Remove(element)
35
36 return nil
37 }
38
39 return fmt.Errorf("dequeue is empty we got an error")
40}
41
42// Front it will return the front value
43func (lq *LQueue) Front() (any, error) {

Callers 1

TestQueueFunction · 0.95

Calls 3

EmptyMethod · 0.95
FrontMethod · 0.45
RemoveMethod · 0.45

Tested by 1

TestQueueFunction · 0.76