title: Undo/Redo using Memento: Stack, Queue or just LinkedList?
body: <p>What is the best having when implementing <a href="http://www.dofactory.com/Patterns/PatternMemento.aspx" rel="nofollow noreferrer">Memento pattern</a> (for Undo/Redo)</p>
  
  <p>in witch collection to Keep Mementos?</p>
  
  <p>Basically, I need this(c = change, u = undo, r = redo):</p>
  
  <pre><code>                  0
                    *c
              -1    0
                    *c
        -2    -1    0
                    *c
  -3    -2    -1    0
                    &lt;u
        -2    -1    0    1
                    *c
  -3    -2    -1    0
  </code></pre>
  
  <p>Variants: </p>
  
  <ul>
  <li><strong>LinkedList</strong> - possible in principle, maybe not optimized.</li>
  <li><strong>Queue</strong> - not adapted for this task, IMO.</li>
  <li><strong>Stack</strong> - not adapted for undo AND redo;</li>
  <li><strong>Double Stack</strong> - maybe optimal, but can't control the undo maximum size.</li>
  </ul>