Assume that sorting can be done in time O(n log n). Refer to this problem below:
ID: 3644121 • Letter: A
Question
Assume that sorting can be done in time O(n log n). Refer to this problem below:-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.)
But Suppose you are now going to implement the Java List API method
public boolean containsAll(Collection<E> c)
in the SinglyLinkedList class. One possible implementation would be to make a copy of the list