I'm having trouble with question 5 from the first quiz. I thought 'guess and check' was covered in lecture 5 in relation to calculating square roots so I tried this speculatively (it'll only work with ints so I kind of knew it was wrong):
1. calculate a max poss value for the answer
2. calculate a min poss value for the answer
3. set guess = minimum
4. while guess<= maximum
if guess = answer +/- epsilon
Obviously this is absolutely nothing like the real answer which I can't make any sense of .... any help much appreciated ...
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
I would have answered something like this. Since the question says exhaustive, one have to enumerate through all the solutions, and test every guess. When you say it works only with int, you're right, but think of the solutions space like a totally ordered space. You always have a way to say that a guess is before or after another one. So it's similar to integers.
I give you an A :)
lol! thanks maitre_kaio! That's what I thought, hence my confusion :)
Having thought about it some more, I've realized that the answer they've given is more like the McNuggets problem set than the square roots example. Perhaps the question is just ambiguous, although that seems strange. Perhaps both answers are valid even though they haven't indicated it in the answers ... unless I'm still missing something ...
I didn't realize the answers were given in the course materials :)
It seems to me that most of the quizz questions have several answers, and some questions (like this one) are pretty vague. I think the professort would have been glad with our answer.
Not the answer you are looking for? Search for more explanations.
You may well be right. I was a bit more concerned that I didn't really understand the answer that they gave; although I think I've figured it out ... I guess I'll just have to live with the ambiguity :(