The sample code SinglyLinkedList is a minimal implementation of a singly-linked
ID: 3644101 • Letter: T
Question
The sample code SinglyLinkedList is a minimal implementation of a singly-linked list. The element type is restricted to be a subtype of Comparable. Implement the following method in the SinglyLinkedList class:// PRECONDITION: a and b are sorted in ascending order and contain no duplicates
// Returns true if every element of list 'c' also appears in list 'a'
public boolean checkContainsAll(SinglyLinkedList<E> a, SinglyLinkedList<E> c)
Let n = a.size() and m = c.size(). Your implementation should be O(n + m). (Note that without the precondition, this method would have to be O(nm). Note also that this should logically be a static method, but it is made nonstatic in order to have access to the inner class Node.)