The linkedlist class uses another class called node which


Assignemnt: Decoding LinkedList

Purpose

To understand how Java implements a linked list

Directions

For this lab you will need to download LinkedList.java from Pilot. This is the source code for the LinkedList class that is part of the core of Java. Your task for this lab is to use this source code to answer the following questions about how a linked list is implemented in Java. Submit your answers to these questions as a PDF file to the dropbox on Pilot.

Question 1: The LinkedList class uses another class called Node (which is defined inside LinkedList.java). What are the fields in the Node class?

Question 2: The Node class uses generics. Why?

Question 3: The linkFirst method contains the following lines of code:
if (f == null)?last = newNode;
else?f.prev = newNode;
What is the value of the linked list+s size attribute at this point in the code if f == null is true?

Question 4: True or False: the removeLast method will take longer to execute the more items are in the linked list.

Question 5: True or False: the public void add(E e)method always adds the new item at the beginning of the linked list.

Question 6: True or False: the public void add(E e) method will take longer to execute the more items are in the linked list.

Question 7: The unlink method contains the following lines of code:
if (prev == null) { first = next;
} else {?prev.next = next; x.prev = null;
}
If the method is called with the first Node in the list as the parameter value, which of these will be executed: the if clause or the else clause?

Question 8: True or false: in general, the contains method takes longer to execute the more items there are in the linked list.

Question 9: The indexOf method always returns -1 if it is passed a null argument.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: The linkedlist class uses another class called node which
Reference No:- TGS02230417

Expected delivery within 24 Hours