title: How to implement a deque using two stacks
body: <p>Deque (&quot;doubled-ended queue&quot;) operations, en-queue and de-queue are possible from both ends.</p>
  <p>How do to I define <a href="https://en.wikipedia.org/wiki/Abstract_data_type" rel="nofollow noreferrer">ADT</a> operations for deque using 2 stacks?</p>
  <p>The implementation should also take performance into consideration.</p>