Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone please help me? in Java, please. You will need two classes: 1. Linkedlist class, which will represent the full list. 2. Node class.
Can someone please help me? in Java, please.
You will need two classes: 1. Linkedlist class, which will represent the full list. 2. Node class. containing a #value method and a link to the #next node . Set both as nil by default. Build the following methods in your linked list class 1. #append adds a new node to the end of the list 2. #prepend adds a new node to the start of the list 3. #size returns the total number of nodes in the list 4. #head returns the first node in the list 5. #tail returns the last node in the list 6. #at (index) returns the node at the given index 7. #pop removes the last element from the list 8. #contains? returns true if the passed in value is in the list and otherwise returns false. 9#find (data) returns the index of the node containing data, or nil if not found. 10. #to_s represent your LinkedList objects as strings, so you can print them out and preview them in the console. The format should be: ( data ) ( data ) .> ( data ) .> nil ### Extra Credit 1. (tinsert at(index)) that inserts the node at the given index 2. #remove-at(index) that removes the node at the given index. (You will need to update the links of your nodes in the list when you remove a node.)
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