Thread: Needing a little bit of help with finding the minimum value

  1. #16
    Registered User
    Join Date
    Oct 2010
    Posts
    11
    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?

  2. #17
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    Quote Originally Posted by nobletype View Post
    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?
    No.

    There was a very specific reason you started your comparisons with 6, what was it.
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #18
    Registered User
    Join Date
    Oct 2010
    Posts
    11
    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.

  4. #19
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    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?
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  5. #20
    Registered User
    Join Date
    Oct 2010
    Posts
    11
    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.

  6. #21
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by nobletype
    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?
    The thing is, I don't understand your problem here. Allow me to quote what you wrote earlier:
    Quote Originally Posted by nobletype
    6 is less than 8. 6 is not less than 2, thus 2 is the newest low number. 2 is less than 9. 2 is not lower than 1, thus 1 is the newest low number. 1 is less than 9. 1 is less than 6.
    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:
    Quote Originally Posted by nobletype
    Now lets say I have a new deck of cards, where my mind is supposed to keep a clean slate in terms of the lowest number. But I can't shake it off. Now, the deck of cards is 4, 2, 6, 7, 10, 3. I won't be able to pick a low number from these because I can't shake off the 1 as the lowest number from my last batch of cards. Thus, I accidentally pick 1 as the lowest number, even if it wasn't part of this new batch of cards.
    Now this does not make sense. That you "accidentally pick 1" is irrational. Obviously, following the process you described earlier, you should now say:
    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.
    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.

    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.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bit value generation doubt
    By roaan in forum C Programming
    Replies: 2
    Last Post: 08-07-2009, 02:23 PM
  2. bit value check efficiency
    By George2 in forum C Programming
    Replies: 5
    Last Post: 11-05-2007, 07:59 AM
  3. porting application from 32 bit to 64 bit error
    By gandalf_bar in forum Linux Programming
    Replies: 1
    Last Post: 09-14-2005, 09:20 AM
  4. Bit processing in C
    By eliomancini in forum C Programming
    Replies: 8
    Last Post: 06-07-2005, 10:54 AM
  5. Array of boolean
    By DMaxJ in forum C++ Programming
    Replies: 11
    Last Post: 10-25-2001, 11:45 PM