import java.util.*;
class HW5Q2 {

  public static void main(String[] args) {

      long t1, t2;

      int i;

      LinkedList<Integer> lst = new LinkedList<Integer>();

      t1 = System.currentTimeMillis();
      for ( i = 37; i != 0; i = (i + 37) % 100000) {
	  lst.add(i);
      }
      t2 = System.currentTimeMillis();

      System.out.println("Insertion into Linked List: " + (t2 - t1));

      t1 = System.currentTimeMillis();
      for (i = 23; i != 0; i = (i + 23) % 100000) {
	  if ( (i % 2) == 0 ) lst.remove(new Integer(i));
      }

      t2 = System.currentTimeMillis();
      System.out.println("Deletion from Linked List: " + (t2 - t1));

      TreeSet<Integer> t = new TreeSet<Integer>();

      t1 = System.currentTimeMillis();
      for ( i = 37; i != 0; i = (i + 37) % 100000) {
	  t.add(i);
      }
      t2 = System.currentTimeMillis();

      System.out.println("Insertion into Tree: " + (t2 - t1));

      t1 = System.currentTimeMillis();
      for (i = 23; i != 0; i = (i + 23) % 100000) {
	  if ( (i % 2) == 0 ) t.remove(new Integer(i));
      }

      t2 = System.currentTimeMillis();
      System.out.println("Deletion from Tree: " + (t2 - t1));

      System.out.println(lst.size());
      System.out.println(t.size());


  }
} 