Edit: Nevermind, I see. Thanks Laser!!!!
Now I am off to brush up on some much needed reading. After all I will eventually need to tackle those "ironwood trees". :D
Type: Posts; User: AndrewHunter
Edit: Nevermind, I see. Thanks Laser!!!!
Now I am off to brush up on some much needed reading. After all I will eventually need to tackle those "ironwood trees". :D
As always laser, thankyou for the insight. I guess I just never thought about it that way....
Huh, I guess I did. Silly me. As for the braces I didn't see the need to do the swap if none is...
You are starting to get there. Let's take a look at your code:
void sortArray(float nums[], int last)
{
int smallest;
int temp;
for (int current = 0; current < last; current++)...
The problem is your implementation of your selection sort.
Lets say I made an array of 5 numbers: -3, -5, 0, 5, 2.
Now in order to sort my array using selection sort I would:
1. start with...
I think so to. Let's take a look at what whiteflags said:
When evaluating numbers the microprocessor is smart enough to understand -5 < -3 < 0 < 3...ect. You don't need any special cases there....
Laser gave you a great starting point for how to evaluate your code and then whiteflags basically spelled out the selection sort algorithm for you.
The selection sort algorithm is:
1. Find the...