I want to order an array of stuffs that may have duplicates. For example:
int values[5] = {4, 5, 2, 5, -1};
int expected[5] = {1, 2, 0, 2, -1};
Here 2 is the smallest element so its order is 0. 4 is the 2nd smallest so its order is 1. 5 is the 3rd smallest and I want both of them have the order 2. I want to skip over certain elements (-1 in the above example) so these elements will have order -1.
How do I do this in C++ or describe an algorithm ?
Thanks
-1that you don't want to consider?