Question: Given the following chain , A, B, C, D, E what does the resultant chain look like after removing the node with the entry E
Given the following chain,
A, B, C, D, E
what does the resultant chain look like after removing the node with the entry E in it?
The remove method is shown below.
public boolean remove(T anEntry)
{
boolean result = false;
Node nodeN = getReferenceTo(anEntry);
while (nodeN != null)
{
nodeN.data = firstNode.data;
firstNode = firstNode.next;
numberOfEntries--;
result = true;
nodeN = getReferenceTo(anEntry);
}
return result;
} // end remove
| A | A, B, C, D | |
| B | B, C, D, A | |
| C | A, B, C, D, null | |
| D | you cannot remove the last node |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
