Algorithms for checking if all elements in array are unique
Hello,I have to compare and find out efficient algorithms for finding out whether all elements in array are different of notCould you please suggest some more efficient algorithms to implement and compare in Java?Thanks in advance,Mike
> I have to compare and find out efficient algorithms
> for finding out whether all elements in array are
> different of not
You can use either a hash table or sort the array. Using a hash table will generally make it more efficient.
Look for "HashMap" and "Arrays.sort()" in Java.