Reference no: EM131434818
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.
Assumption of global macro economy
: 1. What's your assumption of global macro economy in 2017? 2. How do you allocate your investment in different kinds of products this year? (please describe as detailed as you can, e.g. percentage of all products, durations, heding tools size(if ..
|
Forward price and initial value of forward contract
: A stock is expected to pay a dividend of $1 per share in two months and in five months. The stock price is $50, and the risk-free rate of interest is 8% per annum with continuous compounding for all maturities. An investor has just taken a short p..
|
Discuss reasons for supporting and not supporting
: In a paper, discuss the various plans that would be appropriate for consideration and discuss the reasons for supporting and not supporting specific plans.
|
Cost of storing a barrel of oil for one
: The spot price of oil is $80 per barrel and the cost of storing a barrel of oil for one year is $3, payable at the end of the year. The risk-free interest rate is 5% per annum, continuously compounded. What is an upper bound for the one-year futur..
|
What are the fields in the node class
: The LinkedList class uses another class called Node (which is defined inside LinkedList.java). What are the fields in the Node class? The Node class uses generics. Why?
|
How much does the investor gain
: An investor shorts 100 shares when the share price is $50 and closes out the position six months later when the share price is $43. The shares pay a dividend of $3 per share during the six months. How much does the investor gain?
|
Stock symbol for rio tinto plc
: Go to the website Yahoo! Finance and type in the letters "RIO" in the search box and select "Rio Tinto." You should now be directed to a Summary page where you will be able to view the beta for Rio Tinto. Note: RIO is the stock symbol for Rio Tint..
|
Describe the benefits and limitations of expert review
: What is expert review? Describe the benefits and limitations of expert review. Describe the six different types of expert review methods. Summarize the guidelines expert reviewers should follow in order to write effective usability recommendations.
|
How are these issues likely to affect staffing
: Bright Books is a book store chain established 10 years ago in northern Michigan. Bright Books has had great success in Michigan and Ohio and is beginning to expand into other states. Describe some strategic human resource issues Bright Books is like..
|