View the step-by-step solution to:

Implement the SortedList class. The SortedList class extends the AbstractList class. To implement (recursively) all of the abstract methods of the...

Implement the SortedList class. The SortedList class extends the AbstractList class. To implement (recursively) all of the abstract methods of the AbstractList class.

They are:

  • insert (recursive)
  • iterator
  • remove (recursive)
  • retrieve
  • search (recursive)

You must also implement an Iterator inner class for the SortedList class. You must submit a modified SortedList.java file with your source code.

Do not submit and do not modify the List.java or the AbstractList.java file.


Below is the code:



/*
 *
 *  List.java
 *
 */

public interface List<E> extends Iterable<E> {
    void insert(E data);
    void remove(E key);
    E retrieve(int index);
    boolean search(E key);
}

/*
 *
 *  AbstractList.java
 *
 */

public abstract class AbstractList<E> implements List<E> {

    protected class Node<T> {

        protected Node(T data) {
            this.data = data;
        }

        protected T data;
        protected Node<T> next;
    }

    protected Node<E> head;
}

/*
 *
 *  SortedList.java
 *
 */

public class SortedList<E extends Comparable<? super E>> extends AbstractList<E> {

}

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question