Solved

Complete the Following Code

Question 20

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents