Complete the following code.
/** Insert an item at the rear of the queue.
Post: item is added to the rear of the queue.
@param item The element to add
@return true (always successful)
*/
Public boolean ____(E item) {
// Check for empty queue.
If (front == null) {
Rear = new Node<E>(item) ;
Front = rear;
} else {
// Allocate a new node at end, store item in it, and
// link it to old end of queue.
Rear.next = new Node<E>(item) ;
Rear = rear.next;
}
Size++;
Return true;
}
A) offer
B) remove
C) peek
D) getSize
Correct Answer:
Verified
Q15: _ is a technique used to study
Q16: When a queue is implemented using a
Q17: When a queue is implemented using a
Q18: Complete the following code:
/** Returns the next
Q19: Complete the following code:
/** Returns the item
Q21: If a non-circular array is used to
Q22: Complete the following code:
/** Remove the item
Q23: _ traversal implies that you will follow
Q24: _ traversal implies that the nodes visited
Q25: Which of the following contains a syntax
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents