知识卡片

普通读书笔记卡 · 3629.b

记账法以信用预付未来成本

理解等级:中级

记账法可给当前操作收取高于实际成本的摊还费用,并把差额作为对象上的信用,供未来昂贵操作使用。

栈的压入可预付将来的弹出;信用始终非负,才保证任意前缀操作的摊还总额不低于实际总额。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 第16章 摊还分析 · 查看原书依据

      Because each plate on the stack has $1 of credit on it, and the stack always has a nonnegative number of plates, the amount of credit is always nonnegative. Thus, for any sequence of n PUSH, POP, and MULTIPOP operations, the total amortized cost is an upper bound on the total actual cost.

    参考来源

    - 位置:《算法导论(第4版)》第16章《摊还分析》(OEBPS/chapter016.xhtml,文本字符[15000,20000))。 - 结论依据:16.2 节把实际成本之外多收的摊还费用存成对象信用;栈中每个对象持有预付弹出的1美元,信用总额非负,故任意前缀实际成本≤摊还和。 - 原始内容:Because each plate on the stack has $1 of credit on it, and the stack always has a nonnegative number of plates, the amount of credit is always nonnegative. Thus, for any sequence of n P USH , P OP , and M ULTIPOP operations, the total amortized cost is an upper bound on the total actual cost.