Talk:Accounting method (computer science)
![]() | Computer science Start‑class High‑importance | ||||||||||||||||
|
hi every body,
Can any one explain the accounting method with a diagram .
Does it work for other than constant amortized time?
It says in the article "is most naturally suited for proving a O(1) bound", but I do not really understand this sentence. Is it "naturally suited" (and only suited) for this? Or is proving O(1) what it is most suitable for, while it is applicable but less "suitable" for proving other running times?
If it does work for proving other amortised running times, e.g. log n, then it would be really nice with a link to a demonstration this use.
Velle (talk) 23:29, 7 January 2010 (UTC)
dynamic array example
"Inserting element m + 1 requires reallocation of the table. Creating the new table on line 3 is free (for now). The loop on line 4 requires m elementary insertions, for a cost of m. Including the insertion on the last line, the total cost for this operation is m + 1. After this operation, the pool therefore has 2m + 3 - (m + 1) = m + 2."
Explain that you add the 3 to 2m - (m+1) as payment for the last insertion.