Jump to content

Talk:Accounting method (computer science)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Nomen4Omen (talk | contribs) at 11:02, 11 December 2018 (Best bound O(n2) ? No, it is O(2×n) !: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputer science Start‑class High‑importance
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
HighThis article has been rated as High-importance on the project's importance scale.
Things you can help WikiProject Computer science with:

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)[reply]

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. —Preceding unsigned comment added by 79.229.210.164 (talk) 11:38, 28 August 2010 (UTC)[reply]

Best bound O(n2) ? No, it is O(2×n) !

The text says at Accounting method (computer science)#Table expansion:

"Without amortized analysis, the best bound we can show for n insert operations is O(n2) — this is due to the loop at line 4 that performs num(T) elementary insertions."

But I count unrolling "the loop at line 4":

Effective Repeated New Together
1 0 1 1
2 1 1 3
4 2 1+1 7
8 4 1+1+1+1 15

So, if n=2k there are n=2k+1–1 = 2×n–1 insertions which is O(2×n), and not O(n2). Pls help me calculating! --Nomen4Omen (talk) 11:02, 11 December 2018 (UTC)[reply]