Question: Consider the generic singly linked list as defined in class via interface GenericList with implementing classes ElementNode and EmptyNode . Code available on GitHub (Links

Consider the generic singly linked list as defined in class via interface GenericList with implementing classes ElementNode and EmptyNode. Code available on GitHub (Links to an external site.). Implement the method GenericList subList(int start, int end) for this list. The method takes a starting index start and ending index end. The item at start should be included in the resulting list, along with all items up to but not including the item at end. List items are numbered from 0. If start and end are equal, the returned list is empty.

  • Be sure to appropriately handle all invalid inputs. Document all error handling appropriately.
  • subList() does not mutate the underlying list; it returns a new list.
  • You may define an additional method or methods on GenericList as part of your solution if you need to.
  • Do not use loops; your solution must be recursive.
  • For this question, no need to do anything with ListADT/ListADTImpl -- just the implementation in ElementNode and EmptyNode.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!