<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Hi Mark et Al<br>
    <br>
    For the question to make sense one has to make the assumption that
    the stack positions start at the bottom with position zero and go up
    to position 4 which is the top of the stack. At the start the bottom
    two (in bold on the PDF) are valid, hence the top of stack pointer
    showing 1. <br>
    <br>
    Below is the completed table and the stack at the start and after
    each step:<br>
    <table width="817" border="0" cellpadding="0" cellspacing="0">
      <col style="width: 26pt;" width="35"> <col style="width: 68pt;"
        width="91"> <col style="width: 23pt;" width="30"> <col
        style="width: 93pt;" width="124"> <col style="width: 22pt;"
        width="29"> <col style="width: 23pt;" width="30" span="2"> <col
        style="width: 48pt;" width="64" span="7"> <tbody>
        <tr style="height: 15.75pt;" height="21">
          <td style="height: 15.75pt; width: 26pt;" width="35"
            height="21"><br>
          </td>
          <td style="width: 68pt;" width="91"><br>
          </td>
          <td class="xl63" style="width: 23pt;" width="30"><br>
          </td>
          <td style="width: 93pt;" width="124"><br>
          </td>
          <td style="width: 22pt;" width="29"><br>
          </td>
          <td style="width: 23pt;" width="30"><br>
          </td>
          <td style="width: 23pt;" width="30"><br>
          </td>
          <td style="width: 48pt;" width="64"><br>
          </td>
          <td style="width: 48pt;" width="64"><br>
          </td>
          <td style="width: 48pt;" width="64"><br>
          </td>
          <td style="width: 48pt;" width="64"><br>
          </td>
          <td style="width: 48pt;" width="64"><br>
          </td>
          <td style="width: 48pt;" width="64"><br>
          </td>
          <td style="width: 48pt;" width="64"><br>
          </td>
        </tr>
        <tr style="height: 15.75pt;" height="21">
          <td style="height: 15.75pt;" height="21"><br>
          </td>
          <td><br>
          </td>
          <td class="xl63"><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td colspan="7" class="xl80" style="border-right: 1pt solid
            black;">Stack at start and after each step</td>
        </tr>
        <tr style="height: 15.75pt;" height="21">
          <td class="xl64" style="height: 15.75pt;" height="21">Step</td>
          <td class="xl65" style="border-left: medium none;">Function</td>
          <td class="xl66" style="border-left: medium none;">Top</td>
          <td class="xl67" style="border-left: medium none;">Output</td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td class="xl64" style="border-top: medium none;">Start</td>
          <td class="xl65" style="border-top: medium none; border-left:
            medium none;">Step 1</td>
          <td class="xl65" style="border-top: medium none; border-left:
            medium none;">Step 2</td>
          <td class="xl65" style="border-top: medium none; border-left:
            medium none;">Step 3</td>
          <td class="xl65" style="border-top: medium none; border-left:
            medium none;">Step 4</td>
          <td class="xl65" style="border-top: medium none; border-left:
            medium none;">Step 5</td>
          <td class="xl67" style="border-top: medium none; border-left:
            medium none;">Step 6</td>
        </tr>
        <tr style="height: 15pt;" height="20">
          <td class="xl68" style="height: 15pt; border-top: medium
            none;" height="20">1</td>
          <td class="xl69" style="border-top: medium none; border-left:
            medium none;">Push (23)</td>
          <td class="xl70" style="border-top: medium none; border-left:
            medium none;">2</td>
          <td class="xl71" style="border-top: medium none; border-left:
            medium none;">Item added (23)</td>
          <td><br>
          </td>
          <td rowspan="5" class="xl92" style="border-bottom: 1pt solid
            black;">Stack position</td>
          <td class="xl71" style="border-left: medium none;"
            align="right">4</td>
          <td class="xl82" style="border-top: medium none; border-left:
            medium none;" align="right">92</td>
          <td class="xl69" style="border-top: medium none; border-left:
            medium none;" align="right">92</td>
          <td class="xl69" style="border-top: medium none; border-left:
            medium none;" align="right">92</td>
          <td class="xl69" style="border-top: medium none; border-left:
            medium none;" align="right">92</td>
          <td class="xl69" style="border-top: medium none; border-left:
            medium none;" align="right">92</td>
          <td class="xl83" style="border-top: medium none; border-left:
            medium none;" align="right">92</td>
          <td class="xl84" style="border-top: medium none; border-left:
            medium none;" align="right">92</td>
        </tr>
        <tr style="height: 15pt;" height="20">
          <td class="xl72" style="height: 15pt; border-top: medium
            none;" height="20">2</td>
          <td class="xl73" style="border-top: medium none; border-left:
            medium none;">Push (18)</td>
          <td class="xl74" style="border-top: medium none; border-left:
            medium none;"> </td>
          <td class="xl75" style="border-top: medium none; border-left:
            medium none;">Item added (18)</td>
          <td><br>
          </td>
          <td class="xl75" style="border-top: medium none; border-left:
            medium none;" align="right">3</td>
          <td class="xl85" style="border-top: medium none; border-left:
            medium none;" align="right">75</td>
          <td class="xl73" style="border-top: medium none; border-left:
            medium none;" align="right">75</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">18</td>
          <td class="xl73" style="border-top: medium none; border-left:
            medium none;" align="right">18</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">75</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">75</td>
          <td class="xl87" style="border-top: medium none; border-left:
            medium none;" align="right">75</td>
        </tr>
        <tr style="height: 15pt;" height="20">
          <td class="xl72" style="height: 15pt; border-top: medium
            none;" height="20">3</td>
          <td class="xl73" style="border-top: medium none; border-left:
            medium none;">Pop</td>
          <td class="xl74" style="border-top: medium none; border-left:
            medium none;">2</td>
          <td class="xl75" style="border-top: medium none; border-left:
            medium none;">Item removed (18)</td>
          <td><br>
          </td>
          <td class="xl75" style="border-top: medium none; border-left:
            medium none;" align="right">2</td>
          <td class="xl85" style="border-top: medium none; border-left:
            medium none;" align="right">23</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">23</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">23</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">23</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">23</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">23</td>
          <td class="xl87" style="border-top: medium none; border-left:
            medium none;" align="right">23</td>
        </tr>
        <tr style="height: 15pt;" height="20">
          <td class="xl72" style="height: 15pt; border-top: medium
            none;" height="20">4</td>
          <td class="xl73" style="border-top: medium none; border-left:
            medium none;">Push (75)</td>
          <td class="xl74" style="border-top: medium none; border-left:
            medium none;"> </td>
          <td class="xl75" style="border-top: medium none; border-left:
            medium none;">Item added (75)</td>
          <td><br>
          </td>
          <td class="xl75" style="border-top: medium none; border-left:
            medium none;" align="right">1</td>
          <td class="xl88" style="border-top: medium none; border-left:
            medium none;" align="right">83</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">83</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">83</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">83</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">83</td>
          <td class="xl86" style="border-top: medium none; border-left:
            medium none;" align="right">83</td>
          <td class="xl87" style="border-top: medium none; border-left:
            medium none;" align="right">83</td>
        </tr>
        <tr style="height: 15.75pt;" height="21">
          <td class="xl72" style="height: 15.75pt; border-top: medium
            none;" height="21">5</td>
          <td class="xl73" style="border-top: medium none; border-left:
            medium none;">Push (92)</td>
          <td class="xl74" style="border-top: medium none; border-left:
            medium none;">4</td>
          <td class="xl75" style="border-top: medium none; border-left:
            medium none;">Item added (92)</td>
          <td><br>
          </td>
          <td class="xl79" style="border-top: medium none; border-left:
            medium none;" align="right">0</td>
          <td class="xl89" style="border-top: medium none; border-left:
            medium none;" align="right">52</td>
          <td class="xl90" style="border-top: medium none; border-left:
            medium none;" align="right">52</td>
          <td class="xl90" style="border-top: medium none; border-left:
            medium none;" align="right">52</td>
          <td class="xl90" style="border-top: medium none; border-left:
            medium none;" align="right">52</td>
          <td class="xl90" style="border-top: medium none; border-left:
            medium none;" align="right">52</td>
          <td class="xl90" style="border-top: medium none; border-left:
            medium none;" align="right">52</td>
          <td class="xl91" style="border-top: medium none; border-left:
            medium none;" align="right">52</td>
        </tr>
        <tr style="height: 15.75pt;" height="21">
          <td class="xl76" style="height: 15.75pt; border-top: medium
            none;" height="21">6</td>
          <td class="xl77" style="border-top: medium none; border-left:
            medium none;">Push (47)</td>
          <td class="xl78" style="border-top: medium none; border-left:
            medium none;"> </td>
          <td class="xl79" style="border-top: medium none; border-left:
            medium none;">Stack full</td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
        </tr>
        <tr style="height: 15.75pt;" height="21">
          <td style="height: 15.75pt;" height="21"><br>
          </td>
          <td><br>
          </td>
          <td class="xl63"><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td><br>
          </td>
          <td class="xl64">Top</td>
          <td class="xl65" style="border-left: medium none;"
            align="right">1</td>
          <td class="xl65" style="border-left: medium none;"
            align="right">2</td>
          <td class="xl95" style="border-left: medium none;"
            align="right">3</td>
          <td class="xl95" style="border-left: medium none;"
            align="right">2</td>
          <td class="xl95" style="border-left: medium none;"
            align="right">3</td>
          <td class="xl95" style="border-left: medium none;"
            align="right">4</td>
          <td class="xl96" style="border-left: medium none;"
            align="right">4</td>
        </tr>
      </tbody>
    </table>
    <br>
    Mike Brookes <br>
    Semi retired gentleman from Copperfield College<br>
    <br>
    On 21/04/2011 1:35 PM, Mark KELLY wrote:
    <blockquote
      cite="mid:BANLkTikRCuA2WHJSQQvKBF4QgJt+2W5MPw@mail.gmail.com"
      type="cite">
      <p class="MsoNormal">Would someone be kind enough to throw me a
        bone about the
        stack question - Q3?<br>
        <br>
        I thought I knew stack implementation from my assembly language
        days with
        Z80... this question feels like walking into someone's
        half-finished thought
        process.  I'm really confused about this.After half an hour of
        conjecture, I’ve tried four times to ask a series of sensible
        questions
        to make sense of it, and have failed every time. <br>
      </p>
      <p class="MsoNormal"><br>
      </p>
      <p class="MsoNormal">The only apparent answer
        involves time travel, reversed arrays, irrelevant stack pointers
        and bogus
        bolding of stack items.  The relationship between the stack and
        the table is only the beginning of the problem...<br>
      </p>
      <p class="MsoNormal"><br>
      </p>
      <p class="MsoNormal">I’d be delighted if anyone could walk me
        through this...</p>
      <p class="MsoNormal"><br>
      </p>
      <p class="MsoNormal">Regards</p>
      <p class="MsoNormal">Mark<br>
      </p>
      <br>
    </blockquote>
    <br>
  </body>
</html>