Link to home
Start Free TrialLog in
Avatar of tamilthambi
tamilthambi

asked on

Remove duplicate elements in a array

How to remove duplicate elements in a array using hash tables and also without using hash tables.


this was an interview question.
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Friedrich,

Perhaps I was not clear enough. I never said that two different values cannot produce same hash. What I said was duplicate values will have the same hash (unless ofcourse you are using some hash function like time()%value). That was the reason I said you need to search the hash bucket before eliminating an element.

Cheers!
sunnycoder