Data structure in java | Computer Science homework help


The files in the lab2 directory contain classes for two different types of

doubly-linked list.  The DList1 class does not use a sentinel, whereas the

DList2 class does.  The DList1 class is not circularly linked, but the DList2

class is (through the sentinel).  Compile and (using

“javac -g”.)

Your task is to implement two insertFront() and two removeFront() methods–one

of each for each list class.  insertFront() and removeFront() insert or remove

an item at the beginning of a list.  Make sure your implementations work for

empty lists, one-node lists, and larger lists.

The main() methods of DList1 and DList2 include test code, which you can run

with “java DList1” and “java DList2”.

Part I:  insertFront in DList1 (1 point)


Write a method called DList1.insertFront() that inserts an int at the front of

“this” DList1.

Part II:  removeFront in DList1 (1 point)


Write a method called DList1.removeFront() that removes the first item (and

node) from “this” DList1.

Part III:  insertFront in DList2 (1 point)


Write a method called DList2.insertFront() that inserts an int at the front of

“this” DList2.  Your code should NOT use any “if” statements or conditionals.

Part IV:  removeFront in DList2 (2 points)


Write a method called DList2.removeFront() that removes the first item (and

non-sentinel node) from “this” DList2.  Your code should not require separate

branches for the one-node case and the more-than-one-node case.  (You will

need one “if”, to handle the zero-node case.)



Run the DList1 and DList2 test code.

1 point:  DList1.insertFront().

1 point:  DList1.removeFront().

1 point:  DList2.insertFront().

1 point:  DList2.removeFront().

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with Australia Assessments
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
good job
Customer 456821, June 11th, 2022
ENG 111
looks very good
Customer 464369, June 25th, 2023
Very good job
Customer 456821, May 13th, 2022
Nice job.
Customer 452441, April 6th, 2022
Customer 463647, December 1st, 2022
English 101
i received the paper early
Customer 461063, November 1st, 2022
Customer 463759, January 21st, 2023
Well-researched content.
Customer 463473, October 25th, 2022
Business Studies
Customer 453413, February 27th, 2020
Customer 452441, April 7th, 2022
Great effort.
Customer 456821, May 11th, 2022
Customer 456821, February 20th, 2022
Customer reviews in total
Current satisfaction rate
3 pages
Average paper length
Customers referred by a friend
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat