None.. All questions were simple. Reverse a linked list, find a duplicate node in the linked list, etc
Sigiloso
ummm it's much simpler than that Mike. Reverse the list: public void reverse(final List list) { Node prev = null; Node next = list.head; Node n = list.head; while(next != null) { next = n.next; n.next = prev; prev = n; n = next; } } as you can see, you don't need a second list. this will run in O(n) time. Also for finding the duplicate. Just use a hash map. on average you get O(1) for insertion into the map and you don't even need to go through the entire list as the question only asks to find "a" duplicate node. so something like this. public Node findDuplicate(final List list) { final Map map = new HashMap(); for(final Node n : list) { if(map.contains(n)) return n; else map.put(n, n); } } Worst case run the loop n times each contains check worst case O(n) but average should be O(1). So your best case runtime for the whole thing should be O(n), and worst case O(n^2).