And then I'm going to just return the bigger of the two. Little bit complicated, but it's basically just implementing this decision tree.
我会计算总价值,然后我会返回两者中的较大值,有点小复杂,但是它就是按照这个决策树在运行。
So the first thing I'm going to do is, I'm going to try and return the value in the memo.
所以我要做的第一件事,就是我将会尝试将,总价值返回到memo中。
Those would count against the overall value of your life.
它们降低了你生命的总价值。
Incidentally, did I ever--equity equals shares or stock, so when I talk about debt-equity ratio, I'm talking about the ratio of the value of the company's debt to the value of all of its stock.
顺便说下,普通股就是股票,负债权益比就是,就是公司负债价值,除以股票总价值
I still have five pounds left, 0 and I still have zero value.
我还剩下5磅,而我的总价值仍为。
Alright, so if I'm at the end of the chain, that's my value.
好了,所以如果我,是在链表的最后,这个就是我的总价值了。
And then when I get to the very end, I'm going to return the bigger of with i and without i.
然后当我到最后时,我会返回包括i物品,和不包括i物品的,总价值中的较大值。
And this is the value currently obtained.
而这是现在获取的总价值。
And the value will be 8, right?
总价值是8,对吧?
Instead of taking that one vase, the thief could take two radios. And get more value. So the greedy thief, in some sense, gets the wrong answer. But maybe isn't so dumb.
这个贼可以带走两个收音机,这样总价值更大,因此这个贪婪的贼,在某种意义上没有得到正确的答案,但是可能它也不笨。
i I've computed the value if I include i.
如果我包括了,我已经计算过总价值。
And so the value of with i will be the value of i plus whatever I can get using the remaining items and decrementing the weight by the weight of i.
所以装上i之后的总价值,就是i的价值加上剩下物品中,符合条件者的所有价值,再在剩余重量中减去i的重量。
应用推荐