SlideShare a Scribd company logo
Prompt
Your task is to create a connected list implementation and a contiguous list
implementation. Both these classes behaves like a list to users but behind the
scenes the connected list class uses a Node class to store the data. This Node
class simply holds the data as well as a reference to the next Node in the list.
The contiguous list class uses an array to hold the data. Both implementations
must implement the ListInterface interface.
For contiguous list a few things should be considered
The array should start at size 10
When an element is added to the list over the size cap the array must
be reallocated with double the size. Then all the data must be copied
over from the previous array. then you must add the new element.
For simplicity the array will only hold Strings. This means the class
implements ListInterface specifically for Strings. I have given you this
code in the starter file.
The ListInterface has the following functions:
void prepend(T e)
Adds the given element to front of the list
void append(T e)
Adds the given element to the end of the list
void insert(int index, T e)
Inserts the given element add the given index
Shifts all elements after the given index up by 1 index
void empty()
Removes all elements from the list
boolean has(T e)
Returns true if the given element exists in the list, false otherwise
T retrieve(int index)
Retrieves the element at the given index, if the index doesnt exist
then return null
boolean isEmpty()
Returns true if the list is empty, false otherwise
T delete(int index)
Deletes the element at the given index and returns it, if the index
doesnt exist then return null
boolean delete(T e)
Deletes the first occurrence of an element from the list if it exists, if
an element is removed return true, false otherwise
boolean deleteAll(Collection c)
Deletes all elements within the given collection, this includes dupli-
cates. If it removes an element then return true, otherwise false
1
T mutate(int index, T e)
Sets the element at the given index to the given element and returns
the old element, return null if the index doesnt exist
int length()
Returns the current length of the list
The following functions must also be implemented:
String toString()
Override toString from Object
Should print out with a square bracket at the front and the back of
the list
Each element should be seperated by a comma and a space
For example if your list had the elements 1 2 and 3 then the
output would be [1, 2, 3]
boolean equals(Object o)
Override equals from Object
Should return true if the contents of your list are equal to the contents
of os list, otherwise false
AND THIS IS THE TEST CLASS

More Related Content

PDF
For this lab you will complete the class MyArrayList by implementing.pdf
PDF
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
PPTX
Java collections
DOCX
Please complete all the code as per instructions in Java programming.docx
PDF
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
PDF
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
DOCX
Array list
For this lab you will complete the class MyArrayList by implementing.pdf
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
Java collections
Please complete all the code as per instructions in Java programming.docx
Note- Can someone help me with the public boolean isEmpty()- public bo.pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Array list

Similar to Prompt Your task is to create a connected list implementation and .pdf (20)

PDF
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
PPT
List in java
PPTX
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
DOCX
Assg 07 Templates and Operator OverloadingCOSC 2336 Sprin.docx
PDF
refman
DOCX
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
PDF
Please help me to make a programming project I have to sue them today- (1).pdf
PDF
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
DOCX
ArrayList.docx
PDF
STAGE 2 The Methods 65 points Implement all the methods t.pdf
PPT
Lecture2
PDF
Write a java class LIST that outputsmainpublic class Ass.pdf
PDF
import java-util--- public class MyLinkedList{ public static void.pdf
PPT
PDF
I need help with this code working Create another project and add yo.pdf
PDF
Objective The purpose of this exercise is to create a Linked List d.pdf
DOCX
Collection frame work
PDF
Please and Thank youObjective The purpose of this exercise is to .pdf
PPTX
Nature Activities Binder _ by Slidesgo.pptx
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
List in java
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
Assg 07 Templates and Operator OverloadingCOSC 2336 Sprin.docx
refman
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
Please help me to make a programming project I have to sue them today- (1).pdf
Lab02kdfshdfgajhdfgajhdfgajhdfgjhadgfasjhdgfjhasdgfjh.pdf
ArrayList.docx
STAGE 2 The Methods 65 points Implement all the methods t.pdf
Lecture2
Write a java class LIST that outputsmainpublic class Ass.pdf
import java-util--- public class MyLinkedList{ public static void.pdf
I need help with this code working Create another project and add yo.pdf
Objective The purpose of this exercise is to create a Linked List d.pdf
Collection frame work
Please and Thank youObjective The purpose of this exercise is to .pdf
Nature Activities Binder _ by Slidesgo.pptx
Ad

More from alsofshionchennai (20)

PDF
Q15 Amabook has average variable costs of $1 and average total costs.pdf
PDF
Provide background and analysis ono The Indian initial farmers p.pdf
PDF
Provide a detailed description for each of the following measures of.pdf
PDF
provide a brief description paragraph on the fungi, then the taxon.pdf
PDF
Proporcione un ejemplo de c�mo las pr�cticas deficientes de gobierno.pdf
PDF
Project ScheduleUse Goods Company Inc. HRM Standardization Project.pdf
PDF
Procedure.pdf
PDF
Project ScenarioPecos Company acquired 100 percent of Suaros outs.pdf
PDF
Professor Jones is very particular when it comes to his morning coff.pdf
PDF
Program Specifications ( please show full working code that builds s.pdf
PDF
Productos m�dicos de Penner El lunes 14 de abril, Neil Bennett, Ge.pdf
PDF
P�Pa+Ba Hice bit Holndsiteur soors places at Non bed.pdf
PDF
Q1.7. What would happen if you could magically turn off decompositio.pdf
PDF
Progressive Corporation (a property and casualty insurance company) .pdf
PDF
Q1. (a) Briefly introduce how Force-directed algorithms encode netwo.pdf
PDF
Q1. part A. can we use if statement and skip else part(ye.pdf
PDF
Q1. Fiscal policy is often focused on replacing spending that is no.pdf
PDF
Q1 Which of the following would be considered a transport epithelium.pdf
PDF
Q1 Find two thoracic vertebrae that fit together and identify .pdf
PDF
Q-1. �El FMI a menudo es visto como el prestamista de �ltimo recurso.pdf
Q15 Amabook has average variable costs of $1 and average total costs.pdf
Provide background and analysis ono The Indian initial farmers p.pdf
Provide a detailed description for each of the following measures of.pdf
provide a brief description paragraph on the fungi, then the taxon.pdf
Proporcione un ejemplo de c�mo las pr�cticas deficientes de gobierno.pdf
Project ScheduleUse Goods Company Inc. HRM Standardization Project.pdf
Procedure.pdf
Project ScenarioPecos Company acquired 100 percent of Suaros outs.pdf
Professor Jones is very particular when it comes to his morning coff.pdf
Program Specifications ( please show full working code that builds s.pdf
Productos m�dicos de Penner El lunes 14 de abril, Neil Bennett, Ge.pdf
P�Pa+Ba Hice bit Holndsiteur soors places at Non bed.pdf
Q1.7. What would happen if you could magically turn off decompositio.pdf
Progressive Corporation (a property and casualty insurance company) .pdf
Q1. (a) Briefly introduce how Force-directed algorithms encode netwo.pdf
Q1. part A. can we use if statement and skip else part(ye.pdf
Q1. Fiscal policy is often focused on replacing spending that is no.pdf
Q1 Which of the following would be considered a transport epithelium.pdf
Q1 Find two thoracic vertebrae that fit together and identify .pdf
Q-1. �El FMI a menudo es visto como el prestamista de �ltimo recurso.pdf
Ad

Recently uploaded (20)

PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Classroom Observation Tools for Teachers
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Institutional Correction lecture only . . .
FourierSeries-QuestionsWithAnswers(Part-A).pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
01-Introduction-to-Information-Management.pdf
VCE English Exam - Section C Student Revision Booklet
Final Presentation General Medicine 03-08-2024.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Chinmaya Tiranga quiz Grand Finale.pdf
GDM (1) (1).pptx small presentation for students
A systematic review of self-coping strategies used by university students to ...
2.FourierTransform-ShortQuestionswithAnswers.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Microbial diseases, their pathogenesis and prophylaxis
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Classroom Observation Tools for Teachers
human mycosis Human fungal infections are called human mycosis..pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Institutional Correction lecture only . . .

Prompt Your task is to create a connected list implementation and .pdf

  • 1. Prompt Your task is to create a connected list implementation and a contiguous list implementation. Both these classes behaves like a list to users but behind the scenes the connected list class uses a Node class to store the data. This Node class simply holds the data as well as a reference to the next Node in the list. The contiguous list class uses an array to hold the data. Both implementations must implement the ListInterface interface. For contiguous list a few things should be considered The array should start at size 10 When an element is added to the list over the size cap the array must be reallocated with double the size. Then all the data must be copied over from the previous array. then you must add the new element. For simplicity the array will only hold Strings. This means the class implements ListInterface specifically for Strings. I have given you this code in the starter file. The ListInterface has the following functions: void prepend(T e) Adds the given element to front of the list void append(T e) Adds the given element to the end of the list void insert(int index, T e) Inserts the given element add the given index Shifts all elements after the given index up by 1 index void empty() Removes all elements from the list boolean has(T e) Returns true if the given element exists in the list, false otherwise T retrieve(int index) Retrieves the element at the given index, if the index doesnt exist then return null boolean isEmpty() Returns true if the list is empty, false otherwise T delete(int index) Deletes the element at the given index and returns it, if the index doesnt exist then return null
  • 2. boolean delete(T e) Deletes the first occurrence of an element from the list if it exists, if an element is removed return true, false otherwise boolean deleteAll(Collection c) Deletes all elements within the given collection, this includes dupli- cates. If it removes an element then return true, otherwise false 1 T mutate(int index, T e) Sets the element at the given index to the given element and returns the old element, return null if the index doesnt exist int length() Returns the current length of the list The following functions must also be implemented: String toString() Override toString from Object Should print out with a square bracket at the front and the back of the list Each element should be seperated by a comma and a space For example if your list had the elements 1 2 and 3 then the output would be [1, 2, 3] boolean equals(Object o) Override equals from Object Should return true if the contents of your list are equal to the contents of os list, otherwise false AND THIS IS THE TEST CLASS