// description: based on `geeksforgeeks` description A Queue is a linear structure which follows a particular order in which the operations are performed.
// The order is First In First Out (FIFO).
// details:
// Queue Data Structure : https://www.geeksforgeeks.org/queue-data-structure/
// Queue (abstract data type) : https://en.wikipedia.org/wiki/Queue_(abstract_data_type)
// author [Milad](https://github.com/miraddo)
// see queuearray.go, queuelinkedlistwithlist.go, queue_test.go
package queue
// Node will be store the value and the next node as well
typeNodestruct {
Datainterface{}
Next*Node
}
// Queue structure is tell us what our head is and what tail should be with length of the list
typeQueuestruct {
head*Node
tail*Node
lengthint
}
// enqueue it will be added new value into queue
func (ll*Queue) enqueue(ninterface{}) {
varnewNodeNode// create new Node
newNode.Data=n// set the data
ifll.tail!=nil {
ll.tail.Next=&newNode
}
ll.tail=&newNode
ifll.head==nil {
ll.head=&newNode
}
ll.length++
}
// dequeue it will be removed the first value into queue (First In First Out)