-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
tags: | ||
- Algoritmi/PrimaProva | ||
- Algoritmi/AnalisiAmmortizzata | ||
--- | ||
# Metodo degli Accantonamenti | ||
|
||
Siano $op_{1},op_{2},\dots,op_{n}$ le nostre operazioni, e <br> | ||
$c_{i}=_{def}\text{costo-reale}(op_{i})$ <br> | ||
$\hat{c}_{i}=_{def}\text{costo-ammortizzato}(op_{i}) \qquad$ <ins>Definito da noi</ins>. | ||
|
||
Obiettivo: definire i costi ammortizzati in modo tale che valga: | ||
|
||
$T(n) = \displaystyle\sum^n_{i=1}c_{i}\leq \sum^n_{i=1}\hat{c}_{i}$ | ||
|
||
Se $\hat{c}_{i}>c_{i}, \text{ allora } c_{i}$ unità di costo sono utilizzate per pagare il costo della i-esima operazione $op_{i}$. <br> | ||
Se $\hat{c}_{i}<c_{i},$ la differenza $c_{i}-\hat{c}_{i}$ viene recuperata da crediti immagazzinati nella struttura dati. | ||
|
||
A questo punto, viene raggiunto l'obiettivo prefissato pocanzi. | ||
|
||
Esempi: | ||
- [[Stack Multipop#Multipop con Metodo degli Accantonamenti Accantonamenti|Stack Multipop]] | ||
- [[Contatore binario#Contatore Binario con Metodo degli Accantonamenti Accantonamenti|Contatore Binario]] |