Question: Given the following method within the KWLinkedList class, what does it do? Assume that the size of the list is at least 2. public boolean
Given the following method within the KWLinkedList class, what does it do? Assume that the size of the list is at least 2.
public boolean undefined()
{
E item1, item 2;
Node
Node
for(int i = 0; i < size/2; i++)
{
item1 = p1.data;
item2 = p2.data;
if ( ! item1.equals( item2 ) )
return true;
p1 = p1.next;
p2 = p2.prev;
}
return false;
}
| a. | The method will return true, if the first and last elements are same. | |
| b. | The method will return true, if the list does not contain duplicate elements. | |
| c. | The method will return true, if the list is not same in forward and reverse directions. | |
| d. | The method will return true, if the list is same in forward and reverse directions. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
