Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 84 Online
OpenStudy (anonymous):

Hey guys, 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 return guess increment guess Obviously this is absolutely nothing like the real answer which I can't make any sense of .... any help much appreciated ...

OpenStudy (maitre_kaio):

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 :)

OpenStudy (anonymous):

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 ...

OpenStudy (maitre_kaio):

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.

OpenStudy (anonymous):

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 :(

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Coyote: Poem for @xcoledd1
10 minutes ago 11 Replies 2 Medals
dollheartz: hiiiii
43 minutes ago 5 Replies 0 Medals
russianmafiya: Help me think of titles for any type of song
11 hours ago 0 Replies 0 Medals
Austinsbabygirl4life: Do mods know ppl address?
12 hours ago 4 Replies 1 Medal
Midnight97: Here's the new beat lmk what y'all think!!
32 minutes ago 20 Replies 1 Medal
luhbabyliyahh: Do you realize that frozen was made 13 years ago?u00bf
16 hours ago 2 Replies 1 Medal
luhbabyliyahh: Do you realize that 2020 was 4 years ago??u00bf
16 hours ago 0 Replies 0 Medals
Stringcheese272: i made a song
16 hours ago 0 Replies 0 Medals
Stringcheese272: I made a song lmk wut yall think
16 hours ago 1 Reply 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!