Hi guys, the ideas of graph and dynamic programming seem confuse me a lot. In lec22's code. the subtitles indict that there is a bug in function dpShortestPath(). I don't understand that code very well. How does the bug arise?
Could any one explain that problem more concretely or just give the correct code?
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!
It's fun to watch the video lectures, but it's a headache to just go through the codes...
you need to work with it till you understand how it works. you might have to watch the lecture a few times. just keep at it till you understand it then look for the bug. to be candid it has been a long while since i went thru it and i don't recall what the bug was.
maybe go back and re-watch lecture 21 also
In lec23 about 24:30 , Prof Guttag claims there is a dirty little secret in python.
initializing the memo = None and doing a little bit change of code may be helpful.
Not the answer you are looking for? Search for more explanations.
why wouldn't you want to use a mutable object as a function argument default value ?
Initializing the memo = None turns out to be a wrong answer…It makes no expecting change to the program.
I think I can understand the function shortestPath() now, but still confuse about the dpShortestPath(). The only thing I am sure now is that dpShortestPath() indeed has a bug(s), and the bug must hide in the memo.
here is one of many explanations available for this gotcha
thanks, it begins to make a little sense to me.
But those recursive relations are still very messy.
Maybe I should take an algorithm course, then i can fully understand it.