Question
// return a string representing the values in the list starting from index to end, // seperated by a single space // return empty string
// return a string representing the values in the list starting from index to end, // seperated by a single space // return empty string for invalid start or empty list // O(n) where n is the number of items // Warning: concatenating String objects will yield a O(n^2) solution public String listToString(int start) { //default return, remove or updated as needed return null; } // return a string representing the values in the list, from end to beginning, // seperated by a single space // return empty string for an empty list // O(n) where n is the number of items // Warning: concatenating String objects will yield a O(n^2) solution public String listToStringBackward() { //default return, remove or updated as needed return null; } public Iterator iterator() { //Return an iterator that traverses from //the beginning (head) to the end (tail) of the list //The iterator's hasNext() and next() methods //must both be O(1) //next() should throw a NullPointerException //if you try to use next when there are no //more items (any error message is fine). //update / replace this dummy return statement as needed return null; } public Iterator backwardIterator() { //Return an iterator that traverses from //the end (tail) to the beginning (head) of the list //The iterator's hasNext() and next() methods //must both be O(1) //next() should throw a NullPointerException //if you try to use next when there are no //more items (any error message is fine). //update / replace this dummy return statement as needed return null; }
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