Matthew Brown wrote:There are lots of possible ways of doing that. What have you tried so far?
i am using a loop to traverse the array and find out the total number of occurrence of all elements .
But its not working properly. Can you suggest any other approach.
It's certainly possible that way - maybe you should show us your code and tell us what's not working. One thing - you might find it easier if you sort the array into ascending order first.
Or copy the array and sort and search the copy.
Or copy all values into a set; adding values to a Set in Java™ gives a return value which might be helpful.
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
Gift giving made easy with the permaculture playing cards