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

On problem 8.3 could someone help me out. When I run this http://dpaste.com/578711/ my computer runs for several minutes, but returns something like: "The time to run greedy is 3.09944152832e-06 and the time to run brute force is 2.14576721191e-06 greedy is 1.44444444444 times faster than brute force" Any ideas? Brute force takes forever to run, while greedy runs really quickly. Not sure where I'm going wrong.

OpenStudy (anonymous):

I've never passed an entire function, complete with arguments as an argument into a piece of code, have you tried writing code for greedy time and brute time separately and see if that doesn't do something more logical

OpenStudy (anonymous):

Something like this works printSubjects(greedyAdvisor(subjects,2,cmpRatio)). I'll mess with the timing aspect later. You don't know if there has been any discussion on 8.4. I'm struggling quite a bit with it.

OpenStudy (anonymous):

well your not passing "greedyAdvisor(subjects,2,cmpRatio)" as the argument, your passing what that function returns, the dictionary list, not the program itself

OpenStudy (anonymous):

You're right. You don't still have the code to 8.4 do you? The links for a previously discussion about it have expired.

OpenStudy (anonymous):

http://dpaste.com/579255/ that is my problem 4, anything you need specific

OpenStudy (anonymous):

I was having trouble with the memoization component. It wasn't behaving the way I expected it to. I'm going to mess with it for a while longer, will post again if there is something more specific. Thanks for reposting the code.

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