I give up. I tried looking at alternate ways but I really can't figure it out. Can you please post what you had in mind?
I give up. I tried looking at alternate ways but I really can't figure it out. Can you please post what you had in mind?
Because that's the first number that was given to me.
Seriously, I don't know what else to say. Leading someone on to figure it out isn't always the best option if they just can't figure it out. If that's how my C++ teacher taught the class no one would get anywhere.
I wave the white flag. Please let me know the side of the coin.
Too bad.
If you only chose 6 because it was the first in the deck, why are you trying to use the minimum of the first deck while sorting the 2nd deck?
╔╗╔══╦╗
║║║╔╗║║
║╚╣╚╝║╚╗
╚═╩══╩═╝
Because I have no idea how to go through the loop again without looking at the minimum of the integer from the loop prior. Sheesh, forget it. Obviously I'm not going to get any help here no matter how many times I say I can't figure out. What's the point of reaching out for help if all I get is "think logically" no matter how many times I say it's out of my reach? How people get help here is beyond me.
Thanks anyway.
The thing is, I don't understand your problem here. Allow me to quote what you wrote earlier:Originally Posted by nobletype
That is great. You described the process, and arrived at the answer in a way that can be translated into a C++ program. But then you also wrote:Originally Posted by nobletype
Now this does not make sense. That you "accidentally pick 1" is irrational. Obviously, following the process you described earlier, you should now say:Originally Posted by nobletype
If you get over this irrational thinking, you will have what MWAAAHAAA and I were getting at earlier: you pick the first number of the list as the lowest number, and then go through the rest of the numbers, comparing the current number with the current lowest number. When you have gone through the entire list, the current lowest number must be the lowest in the entire list. It is as simple as that.4 is not less than 2, thus 2 is the newest low number. 2 is less than 6. 2 is less than 7. 2 is less than 10. 2 is less than 3.
Now, a variant of this is what you ended up doing: you start by assigning a number higher than any in the list as the lowest number, and then begin looping over the list. This works, but it also means that you need to already know the highest number of the list... or you just assign the highest possible number (which works for the built-in integer types). Yet, ultimately this boils down to the same kind of comparison, after the first iteration of the loop.
Unfortunately, if you insist that you "have no idea how to go through the loop again without looking at the minimum of the integer from the loop prior", then nothing we can say can possibly help you, since you are just being irrational. It is like saying that you will always pay $5 for an ice cream, because that is how much an ice cream costs, even though it is on offer for $2.
Last edited by laserlight; 10-28-2010 at 09:43 AM.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)