Here is my Java code //------------------------------------ public void enqueue(
ID: 3864324 • Letter: H
Question
Here is my Java code
//------------------------------------
public void enqueue(T element) throws NonComparableElementException {
TernaryNode oldtail = tail;
if (isEmpty())
head = tail = new TernaryNode <>();
else
tail = oldtail.getNext ();
size++;
//
}
//-------------------------------------------------------------------
Can you please write down the linked list for this enqueue.
head tail after de queue() operation (size is 5, totalSi is 7): head after a que operation adding a dark blue element head after en another 'dark blue' element headExplanation / Answer
It will take O(1) time to manage the head and tail pointers.
Enqueue:
Dequeue:
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.