i think this could be done if we use binary search tree for finding
the duplicates.
1. take first element in the array as the root.
2. for the next input element(say x) there can be 3 cases:
    2.1  x==root : since this is a duplicate we discard this element
and move to next no. in the list.
    2.2  x<root : set x as left son of root.
    2.3  else : set x as right son of root.
3. continue with all other elements of array and insert them into a
bst. and while inserting them check if that no. is already present in
the bst.(by discarding the no. in case it matches with any node of bst
and moving to next element of array)

this i think can solve the problem in O(n*lgn)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to