I have a set of unbound values stored in an array (it's an NSArray
, if that helps). The values can range from 0 to infinity (in reality the max value is about 100,000,000).
I need to sort the values in my array into a scale of 0 to 20.
For example, if I have a set of 1000, 3123, 31
, 31 would be 0, 1000 would be 10 and 3123 would be 20. The arrays vary in number of members and in max values, so I know if there are a lot of values with different ranges, a lot of those values would take up the same positions on the scale. Most of the time, the number of items will be way over 20 (the average number of items is about 100).
When the number of items is over 20, some of the items should have the same rating.
I need this for visual representations of songs' populatities per search queries, where those values are the global representations of the song's position on a global chart.
Is it possible to create such an algorithm?