Complete the code to create a new node with the given value.
newNode := &Node{data: [1], next: nil}The new node should store the given value in its data field.
Complete the code to check if the queue is empty before enqueue.
if [1] == nil { head = newNode; tail = newNode } else { tail.next = newNode; tail = newNode }
We check if the head is nil to know if the queue is empty.
Fix the error in updating the tail pointer after enqueue.
tail = [1]After adding the new node, tail should point to it.
Fill both blanks to link the new node and update tail correctly.
tail.[1] = [2]
We set tail.next to newNode to link it, then update tail to newNode.
Fill all three blanks to complete the enqueue function using linked list.
func enqueue(value int) {
newNode := &Node{data: [1], next: nil}
if [2] == nil {
head = newNode
tail = newNode
} else {
tail.[3] = newNode
tail = newNode
}
}The new node stores the value. We check if head is nil to see if queue is empty. Then we link tail.next to newNode.
