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

Please help me to spot the bug.In ps8 bruteForceAdvisor doesn't return the same results as dpAdvisor.Here is my code: http://codepad.org/RPGKEtLA

OpenStudy (anonymous):

i didn't look real close but: is your algorithm is attempting to mimic the process of working through the binary decision tree that was shown in the lecture? if so; i don't see any comparisons between branches that take an item or don't take an item - comparisons to see which was better at line 41 and 46, what is subset doing - i see that it contains a list of 'i' values but i don't see that it is being used at all hmmm definitely looks like it is trying out lots of different combinations but it never compares combinations to see which is better

OpenStudy (anonymous):

Actually I thought the same way too but it compares.Another problem is with D.tree I could not understand it properly according to what we have to construct it.

OpenStudy (anonymous):

what do you mean by D.tree? where are you comparing? at line 42 and 47 you assign differen values/results/branches to the same variable at each node of the decision tree you can either take the item or not take it before you go down the branch - you have to try both but you don't know which is better so you have to compare them - i don't see the comparison in your code

OpenStudy (anonymous):

I am having a trouble with constructing Decision tree.Do we have to account for all variables when we construct it?As for the code it was taken from the assignment(ps8) skeleton code and modified a little with keeping track of solutions.I doubt that they made a mistake.Thanks for response!

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!