Question
can you please help me fix this error SortedList.java code: package DSA; public class SortedList { private static int MAX = 10; private int size;
can you please help me fix this error
SortedList.java code:
package DSA; public class SortedList
public int size() { return size; }
public boolean isFull() { return size == MAX; }
public boolean isEmpty() { return size == 0; }
public SortedList() { this(MAX); }
public SortedList(int capacity) { MAX = capacity; info = ((E[]) new Object[capacity]); }
public void addItem(E item) { // change this code to make sure that the size does not exceeds MAX // print a message (check output) in case size of MAX is exceeded if(isFull()){ //checks if the list is full System.out.println("List is full with "+size+" items: "+toString()); //print the statements with list values }else{ int i; for (i = 0; i (Integer) info[i]) continue; else break; } for (int index = size; index > i; index--) info[index] = info[index - 1]; info[i] = item; size++; }}
public boolean getItem(E item) { // Change this method to print visited numbers info[i] and to stop if // info[i]>item String s=" "; for (int i = 0; i
public boolean getItemBSA(E item) { // Change this method to print visited numbers info[mid] String s=" "; int mid; int first = 0; int last = size - 1; boolean moreToSearch = (first (Integer) info[mid]) { first = mid + 1; moreToSearch = (first
public boolean deleteItem(E item) { for (int i = 0; i
public String toString() { // implement this method String s=" "; for(int i=0;i public void mergeLists(SortedList Task1 SortedList Driver code: class Task1 { public static void main(String[] args) { SortedList
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