Z
zelao.itu
Hey everybody, I'm having troubles with sorting a vector based in
another vector:
Example:
String [] models = {"Anna","Gisele","Yasmin"}
int [] ranking ={3,1,2}
....After sorting it might be this :
models = {"Gisele","Yasmin","Anna"}
ranking = {1,2,3}
It's because i sorted the models' vector based on ranking vector, and
it could accept duplicate datas;
So how can i do that ??????
I think about do a bubble sort in ranking vector and when the
condition met (like ranking[0] > ranking[1]) I swap both vectors, but
I don't think it's the best way. There is another one ?
another vector:
Example:
String [] models = {"Anna","Gisele","Yasmin"}
int [] ranking ={3,1,2}
....After sorting it might be this :
models = {"Gisele","Yasmin","Anna"}
ranking = {1,2,3}
It's because i sorted the models' vector based on ranking vector, and
it could accept duplicate datas;
So how can i do that ??????
I think about do a bubble sort in ranking vector and when the
condition met (like ranking[0] > ranking[1]) I swap both vectors, but
I don't think it's the best way. There is another one ?