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

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!