Sorting a vector based on another datas



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 ?

.



Relevant Pages

  • Re: The horse race
    ... allow sorting. ... wondered that if a relation includes a horse's ranking, ... this is a very basic question. ... It suggests almost mere semantics. ...
    (comp.databases.theory)
  • Re: Changing the position of rows
    ... You a dummy column next to your data. ... ranking that will produce the required results. ... Then sort the data using ... > It dosn't necessarily mean sorting, for example in a column, I may have ...
    (microsoft.public.excel.programming)
  • Re: Sorting a vector based on another datas
    ... int ranking = ... I think about do a bubble sort in ranking vector and when the ... private final int ranking; ... Rank 1: 'Gisele' ...
    (comp.lang.java.programmer)