moshikafya
moshikafya

Reputation: 3320

a histogram life datatype in objective c / iphone app

I have an array with many numbers, which I would like to convert into a histogram like array where for each number I have the number of occurrence of this number in the array. I tried to look everywhere if there are any APIs for xcode but could not find.

What would be the best way to go about that?

Thanks!!!

Upvotes: 0

Views: 125

Answers (1)

TommyG
TommyG

Reputation: 4155

 NSCountedSet *set = [[NSCountedSet alloc] initWithArray:array];

Where array is the combined array containing all your elements.

Upvotes: 1

Related Questions