Thread: ordering arrays
View Single Post
Join Date: Mar 2008
Posts: 63
Reputation: 666kennedy is an unknown quantity at this point 
Solved Threads: 0
666kennedy 666kennedy is offline Offline
Junior Poster in Training

Re: ordering arrays

 
0
  #6
Nov 20th, 2008

indices[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
// sort errors array
for(int i = 0; i < 15; i++)
{
for(int j= i+1; j < 16; j++)
{
if( errors[ indices[i] ] < errors[ indices[j] ] )
{
int temp = indices[i];
indices[i] = indices[j];
indices[j] = temp;
}
}
}
could you please explain how this works, like im more dumbed down, i can kinda see how it would work, but if u could just run through it in words or something that would be grately appreciated
Reply With Quote