title: Stacks and queues concept
body: <p>What would be the value of queues Q1, Q2 and stack S after the following algorithm
  segment:</p>
  <ol>
  <li>S = createStack</li>
  <li>Q1 = createQueue</li>
  <li>Q2 = createQueue</li>
  <li>enqueue (Q1, 5)</li>
  <li>enqueue (Q1, 6)</li>
  <li>enqueue (Q1, 9)</li>
  <li>enqueue (Q1, 0)</li>
  <li>enqueue (Q1, 7)</li>
  <li>enqueue (Q1, 5)</li>
  <li>enqueue (Q1, 0)</li>
  <li>enqueue (Q1, 2)</li>
  <li>enqueue (Q1, 6)</li>
  <li>loop (not emptyQueue(Q1))</li>
  <li>Dequeue(Q1,x)</li>
  <li>If(x==0)
  1.z=0
  2.loop(not emptyStack(S)</li>
  <li>popStack(S,y)</li>
  <li>z=z+y
  3.end loop
  4.enqueue(Q2,z)</li>
  <li>else
  1.pushStack(S,x)</li>
  <li>end if</li>
  <li>end loop</li>
  </ol>