Skip to content

Commit

Permalink
Aggiunge stack inizialmente non vuoto
Browse files Browse the repository at this point in the history
  • Loading branch information
Darakuu committed Dec 15, 2023
1 parent b77cddb commit 673647f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions content/Stack Multipop.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,16 @@ Abbiamo trovato gli stessi valori degli altri metodi: $2\times\#\text{push} = 2n
Questa è una manifestazione della Proprietà di Confluenza: i crediti non dipendono dalla sequenza, ma dalla struttura dati.
### Stack inizialmente non vuoto
Se lo stack non è vuoto, purché non sia enorme, le sue operazioni rimangono lineari.
$$\begin{align}
\displaystyle\sum^n_{i=1}c_{i} &= \sum^n_{i=1}-\phi(D_{n})+\phi(D_{o}) \\
& \leq 2\times\#\text{Push} - |S_{n}|+|S_{0}| \\
& \leq 2\times n\qquad\ \ -|S_{n}|+|S_{0}| \\
& \leq 2 \times n \qquad\qquad\quad\ \ +|S_{0}| \\
\end{align}$$
Se $|S_{0}|=O(n) \implies \displaystyle\sum^n_{i=1}c_{i}=O(n)$

0 comments on commit 673647f

Please sign in to comment.