Question: In the LinkedList implementation of Section 16.1, we use a flag isAfterNext to ensure that calls to the remove and set methods occur only when
In the LinkedList implementation of Section 16.1, we use a flag isAfterNext to ensure that calls to the remove and set methods occur only when they are allowed. It is not actually necessary to introduce a new instance variable for this check. Instead, one can set the previous instance variable to a special value at the end of every call to add or remove. With that change, how should the remove and set methods check whether they are allowed?
Step by Step Solution
3.38 Rating (148 Votes )
There are 3 Steps involved in it
In the implementation of LinkedList youre referring to after each call to add or remove instead of s... View full answer
Get step-by-step solutions from verified subject matter experts
