Factorial is N * n-1 * n-2 .... 1 and 0 We know 0 and 1 are both 1 Everything else is N*........1 public int factorial(int n){ if(n < 2) return 1; return n*factorial(n-1); } public int factorial(int n){ return (n < 2) ? 1 : n * factorial(n-1); //TERNIARY return (IS THIS TRUE) ? TRUE : FALSE; } Fib 0 = 0 , Fib 1 = 1 FIB 2 = 1 if(n == 0) return 0 if (n == 1) return 1 if (n == 2) return 1 else fib(n-2) + fib(n-1) if(n < 3) return 1 else return fib(blah blah) return (n < 2) ? n : fib(n-2)+fib(n-1); Recursion (n) : see recursion. Student implements Comparable{ private int getID; public int compareTo(Student s){ return new Integer(getId).compareTo(new Integer(s.getId()); //sorry I got lazy and you didn't say I couldn't. } } public MyLinkedList implements List{ private LinkedList list; public Student get(int n){ return list.get(n); } public boolean add(Student s){ return list.add(s); } public static void main(String ...args){ //START and STOP long start = System.nanoTime(); for(int i = 0; i < MAX; i++){ Double d = new Double(i); } long stop = System.nanoTime(); System.out.println("DIFFE ns:" + (stop-start)); } //start time //DO WORK for X // stop time public long timeWork(int max){ long start = System.nanoTime(); //HERE YOU DO ADD OR WHATEVER YOU ARE TIMING long stop = System.nanoTime(); return (stop-start); } DOUBLE 100M = 655472792 double 100m = 102970091 double d = (double) i. VS Double d = new Double(i); THIS WILL BE IMPORTANT Collections.sort(list); Arrays.sort(array); WITH 1M = DIFFE ns:12412393 10M = DIFFE ns:90037921 100M = DIFFE ns:728176343 }