Trouble with Selection Sort and populating an array in reverse
Posted on 2006-05-04
I'm trying to automatically populate an array in reverse to get the worste case scenario and time the selection sort algorithm. I was able to get the best case scenario to work fine, but it seems that populating an array in reverse is kind of confusing. I'm pretty sure I'm doing it right, but it keeps inserting only the value of, "n" in all the indexes of my array A;
I've tried it a lot of different ways. This is my current attempt. My others involved a for loop, which I believe should have worked too.
inputs:: the user is asked how large of an array do they want to populate, then that number is defined as n.
int reverse = 0;
//std::cout << i <<" "<< n << "\n";//testing the order
}//end of for loop
I can post more of my code, if you think that will help