Question 1: What is the Big-O running time of the subsequent code fragment?
Assume lst has N items.
public static void erase( List lst )
{
Iterator itr = lst.iterator();
while ( itr.hasNext() )
{
Integer x = itr.next();
itr.remove();
}
}
a. If an ArrayList is passed for lst. Describe your answer.
b. If a LinkedList is passed for lst. Describe your answer.