Answered step by step
Verified Expert Solution
Question
1 Approved Answer
21. In the lecture notes, we have discussed the use of a linked list for implementing the queue ADT. You are required to compose and
21. In the lecture notes, we have discussed the use of a linked list for implementing the queue ADT. You are required to compose and test the Java programs. You need the following classes: In order to trace the contents inside the entire queue, you need to add a method toString() in the LinkedQueue class. Note that, however, the toString() method is not part of the Queue ADT. public string tostring() \{ return qll.tostring (); \} last node in a linked list. The purpose of this exercise is to have an empirical study on the impact of using the tail reference on a linked list. (a) Copy your programs in Q1 to a new folder Q3a. Add the program LinkedQueueTiming.java given below. Execute the program multiple times with different value for num . Record the execution time as reported by the program in a spreadsheet. For example, Later, you will be required to plot a graph using the data in the table. For better results, you should execute the program as many times as you can with "small" increments. (b) Copy your programs in Q3(a) to a new folder. Q3(b). Modify the Java program LinkedList.java so that the linked list does not contain the tail reference. Needless to say, when the last node in the linked list is wanted, you need to traverse the list from the head towards its end until the last node is reached. Execute LinkedQueueTiming again using the same set of num values as in Q3(a). Record the execution time as reported by the program in the spreadsheet. (c) Plot a graph using the data in the spreadsheet. What can you observe
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started