Question: Our linked-list implementation (Fig. 21.3) used both a firstNode and a lastNode. The lastNode was useful for the insertAtBack and removeFrom- Back methods of the

Our linked-list implementation (Fig. 21.3) used both a firstNode and a lastNode. The lastNode was useful for the insertAtBack and removeFrom- Back methods of the List class. The insertAtBack method corresponds to the enqueue method of the Queue class. Rewrite the List class so that it does not use a lastNode. Thus, any operations on the tail of a list must begin searching the list from the front. Does this affect our implementation of the Queue class (Fig. 21.11)?

Step by Step Solution

3.38 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The interface of the List class was not changedjust its implementation T... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java How to Program Early Objects Questions!