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

I'm having trouble with problem set 8. I have two pieces of code, one returns the a list with repeating instances, the other doesn't pull the best numbers, I've tried to memo both the hand out from lecture 13 or 14, and the brute force adviser from earlier in the problem set, http://dpaste.com/554284/ AND http://dpaste.com/554285/ if someone could tell me where I'm going wrong, I'd appreciate it

OpenStudy (anonymous):

still looking, might take me a while.. but a couple of things: 1st post line 15 - why do you sort names? if you don't sort names then lines 16-18 can be accomplished with --- values = subjects.values(). the index relationships will be maintained... i asked this on the Python irc channel and everyone said yes see the note to the items method http://docs.python.org/library/stdtypes.html#dict.items your first post is very similar to what i did, but i only kept track of the indices in dpAdvisorHelper and returned those. your lines 46-59 look different than what i did 'at the end' can't tell yet. here's mine: http://dpaste.com/554444/

OpenStudy (anonymous):

or here's the file with some builtin tests

OpenStudy (anonymous):

I actually did the sort thing for debugging purposes, it was hard to keep track of things when i didn't know what index led to what values, also note for testing purposes my list of subjects is restricted to the 6.00-6.19 courses, 46-59 was necessary to record both value and indexes, I've included your branch_value() function and followed your idea of keeping only indecies, cleaned up my code a bit, and its running as i expect it but i haven't tested it thoroughly, but I get the answer I wanted with the full list at 30 work units. thank you so much for your help, I've been stuck for the better part of two weeks

OpenStudy (anonymous):

this one also took me a long time and a lot of 'research'/reading. i've been looking at your original code (the first one) and comparing parts of it to mine but i cannot find where th problem is. if you can pinpoint the difference that was causing yours to behave incorrectly, i'd really like to know.

OpenStudy (anonymous):

I haven't found why its acting differently, but something in the fact i was trying to record two pieces of information, the index list (or i think in my case the list of course names) and the value, it was just messing up, the memo didn't take it well, it kept repeating numbers leaving me with an index list at the end that was twice the size of the subject list and far exceeded the work value. either way i guess Occam s razor applies here, simpler is better

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
Breathless: womp
14 minutes ago 0 Replies 0 Medals
Breathless: yo who wanna match pfp?
16 minutes ago 11 Replies 1 Medal
Ylynnaa: This was long time ago lmk if u fw itud83dude1d
4 hours ago 17 Replies 2 Medals
abound: Wow question cove really fell off
6 hours ago 6 Replies 1 Medal
ayden09: chat i love black pink hehe i like jones to
5 hours ago 20 Replies 2 Medals
kamani7676: help
1 day ago 5 Replies 1 Medal
kamani7676: Help
1 day ago 76 Replies 2 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!