Sorting a vector based on another datas
- From: "zelao.itu@xxxxxxxxx" <zelao.itu@xxxxxxxxx>
- Date: 31 Jan 2007 03:13:27 -0800
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 ?
.
- Follow-Ups:
- Re: Sorting a vector based on another datas
- From: Daniel Pitts
- Re: Sorting a vector based on another datas
- From: Kai Schwebke
- Re: Sorting a vector based on another datas
- From: Lew
- Re: Sorting a vector based on another datas
- Prev by Date: Re: Off-topic: Corrisponding Successfulness of Software Engineers with Communication Ability...
- Next by Date: Re: active record
- Previous by thread: jsp
- Next by thread: Re: Sorting a vector based on another datas
- Index(es):
Relevant Pages
|
|