Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me to make UnsortedList and SortedList class using the todo tags to implement the method. We are given some do not modify pages,

Please help me to make UnsortedList and SortedList class using the todo tags to implement the method.

We are given some do not modify pages, please compile them together with no errors and passed all the sanity check

image text in transcribedimage text in transcribed
03 lululnlulululul '5"? Tllllll | I | | | l'l'r omlmlmlol | | | |3|U|3|2UITITI lmlmlmlllmlm X Ulmlgl Tlmlmlmlmlml'al'al | l3 G A Not secure | 18.224.94.128/:curse/indexphp7page:94 A\" CS 211 Syllabus Modules Print Logout Assignment #4 - Circular Contents Background Background: Objectives Linked List is a sequence of links which contains items. Each Explanations node consists of its own data and the address of the next node W 1; and forms a chain. The purpose of this assignment is to get A B Extra Credit familiar With the linked list structure along With generic data type. in this assignment, you Will involve constructing Java functions that use linked nodes and list references to operate the elements in the list. Guidelines Download Objectives: SubmiSSion This assignment will assess your mastery of the following objectives: a To construct two circular linked lists that are unsorted and sort. Rubric a To understand how node references work in the linked lists. v To perform basic operations in the linked list. References Rules and Explanations: History The original linked list has a reference to the first element (head) of the list. In this assignment, you are ask to constructa circular linked list that has a reference to the last element (tail) of the list. To maintain the concept of circular, we do not want the last element points to nowhere, and because of that reason, we will have the last element (tail) points back to the first element (head). i i Head > l List A 1 AbstractList A Unso rtedLisl SortedList . 36 F D Search Cloudy I} {38713 Diep Huynh + 7 11:04 PM 3/3/2023 Do 0 0 0 0 0 0| B| BO|RA| | |CQQBWWWCCCC BLOOD W WW WW XX WEB WWWWWWCCCCCB + X A Not secure | 18.224.94.128/course/index.php?page=94 A" to 3 CS 211 Syllabus Modules Print Logout Diep Huynh The list structure must maintain the reference to the last element of the list after every single operation called. The only case we have a list node null when the list is empty, the tail reference is pointing to null. The last element (tail) must be linked to the first element (head) of the list. Contents There is an interface called List that has a single generic data type "Type". The List provides prototypes as following: Background Method Description Objectives public int getSize() The method returns the number of elements in the list. + Explanations public boolean isEmpty() The method returns true if the list is empty otherwise false. Extra Credit public boolean contains(Type value) The method returns true if the list contains the given value otherwise false. public void insert(Type value) The method insert the given value into the list. Guidelines public void clear() The method removes all elements from the list. Download public String toString() The method returns the list in string format. For example: "[1, 2, 3, 4]" Submission public Type value remove(Type value) The method removes and returns the given value from the list. Rubric public int getindex(Type value) The method returns the index of the given value. (return -1 if the value is not found) References public Type removeAtIndex(int index) The method removes and returns the value at the given index. History public void set(int index, Type value) The method assigns the given value to the list at the given index. public Type get(int index) The method returns the value of the element at the given index. public Iterator iterator() The method returns the iterator of the list. Note: the program should throw java.lang.IndexOutOfBoundsException if the given index is invalid. The AbstractList is also provided with some methods already implemented from the List: getSize, isEmpty, getindex, toString, and iterator. That means the List.java and AbstractList.java files should remain unmodified. You will need to implement two different circular linked lists: 1. UnsortedList: the circular unsorted linked list, we extends this concrete class from the AbstractList class and implement all prototypes from the interface List 2. SortedList: the circular sorted linked list, we extends this concrete class from the AbstractList class and implement all prototypes from the interface List. We must find the right spot to place the new element in the list. That means the list always remains sorted in ascending order. The generic data type for this list must be comparable. Note: some IDEs (Eclipse, IntelliJ, Netbeans, etc.) automatically import the built-in Java List interface and AbstractList class which refer to 38OF Cloudy Search 11:04 PM 3/3/2023 19

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions