Here is a quick sketch of the solutions. In grading, I am looking only for a few things on each question, and an overall understanding of the important concepts. 1. (a) O( N^2 ) because of the nested loops, and the calls to get are O(1) (b) O( N^3 ) because of the nested loops, and each get is O(N)time (c) For a quadratic algorithm, when N is increased by a factor of 2, the running time increases by a factor of 4. So the time will be 40 sec. (d) Use an iterator to get an O( N^2 ) algorithm for all types of lists. OR... sort both lists and do a sequential scan of the lists which will be even faster. 2. (a) toArray is O(N) the other two are O(1). (b) public void toArray( AnyType [ ] arr ) { Node p = first; for( int idx = 0; p != null; idx++, p = p.next ) arr[ idx ] = p.data; } (c) public void removeLast( ) { if( first == null ) throw new IllegalStateException( ); if( first == last ) first = last = null; else { last = last.prev; last.next = null; } } (d) public void addFirst( AnyType x ) { if( first == null ) first = last = new Node( x, null, null ); else first = first.prev = new Node( x, null, first ); } 3. (a) public static List getPrimes( Map> m ) { List primes = new ArrayListInteger>( ); for( Map.Entry> e : m.entrySet( ) ) if( e.getValue( ).size( ) == 1 ) primes.add( e.getKey( ) ); return primes; } (b) This is an O( N ) algorithm 4. public static int countFiles( File d ) { int count = 1; if( d.isDirectory( ) ) for( File f : d.listFiles( ) ) count += countFiles( f ); return count; }