previous | start | next

Doubly Linked: Remove Front

This is just as easy and doesn't have to consider the case of size() == 1 separately. The same code should work size = 0 as well as for any size > 0.

Write the code for removeFront(E x) method below for a doubly linked list with 2 guard nodes - head and tail. It should return the element that was removed.

(Assume head and tail are members of the list class.)

E.g., removeFront() should 10 from this list:

to get

 public E removeFront()
{
        
}
   


previous | start | next