- #1
swartzism
- 103
- 0
Not sure if this is the correct place to post this type of question, so I will relocate if need be. What I'm interested in doing is taking an array of numbers and assigning a rank based on ascending order. Explicitly, the ranking of an array would look like
1.534 - 15
-0.887 - 3
-0.489 - 5
0.887 - 13
1.15 - 14
0.157 - 9
-1.15 - 2
0 - 8
0.319 - 10
-0.319 - 6
-1.534 - 1
-0.157 - 7
0.489 - 11
0.674 - 12
-0.674 - 4
So I don't actually want to re-order the array, rather assign a number based on the position's size. I'm coding this in C. It is easy to get the min and max, but how would I go about the rest of the ranking in an efficient manner? Looking ahead, I would like to do this on an array of length 25000!
Thanks in advance
1.534 - 15
-0.887 - 3
-0.489 - 5
0.887 - 13
1.15 - 14
0.157 - 9
-1.15 - 2
0 - 8
0.319 - 10
-0.319 - 6
-1.534 - 1
-0.157 - 7
0.489 - 11
0.674 - 12
-0.674 - 4
So I don't actually want to re-order the array, rather assign a number based on the position's size. I'm coding this in C. It is easy to get the min and max, but how would I go about the rest of the ranking in an efficient manner? Looking ahead, I would like to do this on an array of length 25000!
Thanks in advance