(Choose 1 answer)
FUOVERFLO.COM
Suppose we are implementing a queue using a singly linked list where the end of the list is of the queue.
Specify the correct implementation of enqueue() method of the queue. (Choose the most:
A. void enqueue(Object x){ Node p = new Node(x);p.next = null; OW.COM tail.next = p;tail = p;}
B. void enqueue(Object x){ Node p = new Node(x);p.next = null;if(isEmpty())head = tail = p;else{ tail.next = p;tail = p;}}
C. void enqueue(Object x){ Node p = new Node(x);
FUOVERFLO.COM
p.next = null;
if(isEmpty())
head = tail = p;else
tail.next = p;
Exit (22)