If i have an array of names char *names; (stored as pointers to strings), how to find the name that appears the most times in the array and how many times it appears.
(a) if only one “mode”
(b) multiple “modes”
I'm thinking of implementing something similar to selection sort where each element will be compared to every other element in the array and use a counter to keep track of the duplicates. If i use this technique, i need a counter for each element in the array and i think that's not a smart technique.
There should be a better way to do this. Please give some insights. Thanks