Question
Please do this in Java and make sure that the code works properly. The Main.java file should not be modified and can be seen below
Please do this in Java and make sure that the code works properly.
The Main.java file should not be modified and can be seen below
import java.util.Iterator; import java.util.Random; public class Main { public static void main(String[] args) { List
class SortedList
while (i curr = head; curr != null; curr = curr.next) { if (data.compareTo(curr.data) == 0) { return true; } } return false; } }
List.java is below and should NOT be modified.
/* * * List.java * */ public abstract class Listimplements Iterable { protected class Node { protected Node(T data) { this.data = data; } protected T data; protected Node next; } public abstract void insert(E data); public abstract void remove(E data); public abstract E retrieve(int index); public abstract boolean search(E data); protected Node head; }
SortedList.java is the file you will edit. Make it perfect. the code should run perfectly with the other classes not modified.
/* * * SortedList.java * */ public class SortedListThe Sorted List ADT Implement the Sorted List class. The Sorted List class extends the List class. Both can be seen here. Your assignment is to implement (recursively) all of the abstract methods of the List class. They are: insert (recursive) iterator remove (recursive) retrieve (recursive) search (recursive) You must also implement an Iterator inner class for the Sorted List class. You must submit a modified Sorted List.java file with your source code. Do not submit and do not modify the List.java file or the Main.java file> extends List { }
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