I have what seems to be a simple problem but I can't figure it out so far.
Say I have two arrays:
int[] values = {10,20,20,10,30};
int[] keys = {1,2,3,4,5};
Array.Sort(values,keys);
Then the arrays would look like this:
values = {10,10,20,20,30};
keys = {4,1,2,3,5};
Now, what I want to do is make it so that the keys are also sorted in second priority so the key array to look like this:
keys = {1,4,2,3,5};
Notice the 1 and 4 values are switched and the order of the value array has not changed.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…