Remove duplicates from an unsorted linked list

On October 30, 2011, in Technical Interview, by admin

Q.) Write code to remove duplicates from an unsorted linked list Ans) If we can use a buffer, we can keep track of elements in a hashtable and remove any dups: public static void deleteDups(LinkedListNode n) { Hashtable table = new Hashtable(); LinkedListNode previous = null; while (n != null) { if (table.containsKey(n.data)) previous.next = […]

Weboy