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 ) because of the single loop, and the calls to get are O(1) (b) O( N^2 ) because of the single loop, and each get is O(N)time (c) For a linear algorithm, when N is increased by a factor of 5, the running time increases by a factor of 5. So the time will be 20 sec. (d) Use an iterator to get an O( N ) algorithm for all types of lists. 2. (a) All operations are O(N) because getNode is O(N) and the other two invoke getNode. (b) private Node getNode( int idx ) { if( idx < 0 ) throw new IndexOutOfBoundsException( ); Node ptr = header.next; for( int i = 0; i != idx; i++, ptr = ptr.next ) if( ptr == null ) throw new IndexOutOfBoundsException( ); return ptr; } (c) public void remove( int idx ) { Node p = getNode( idx ); if( p == tail ) throw new IndexOutOfBoundsException( ); p.prev.next = p.next; p.next.prev = p.prev; } (d) public void add( int idx, AnyType x ) { Node p = getNode( idx ); p.prev = p.prev.next = new Node( x, p.prev, p ); } 3. (a) public static List duplicateCodes( String [ ] arr ) { Map codes = new HashMap( ); for( String id : arr ) { String thisCode = "XXX" + id.substring( 3 ); Integer count = codes.get( thisCode ); if( count == null ) codes.put( thisCode, 1 ); else codes.put( thisCode, count + 1 ); } List result = new ArrayList( ); for( Map.Entry e : codes.entrySet( ) ) if( e.getValue( ) >= 2 ) result.add( e.getKey( ) ); return result; } 4. public static File findMax( File d ) { File maxFile = d; if( d.isDirectory( ) ) for( File f : d.listFiles( ) ) { File thisFile = findMax( f ); if( thisFile.length( ) > maxFile.length( ) ) maxFile = thisFile; } return maxFile; }