{
  "translations" :{
    "en": {
      "sc1": "One choice is to make the top be at position 0 in the array. In terms of list functions, all push and pop operations would then be on the element at position 0.",
      "sc2": "This implementation is inefficient, because now every push or pop operation will require that all elements currently in the stack be shifted one position in the array, for a cost of $\\theta(n)$ if there are $n$ elements.",
      "sc3": "The other choice is have the top element be at position $n-1$ when there are $n$ elements in the stack. In other words, as elements are pushed onto the stack, they are appended to the end of the list.",
      "sc4": "Method <code>pop</code> removes the last element. In this case, the cost for each push or pop operation is only $\\theta(1)$.",
      "sc5": "For the implementation of <code>AStack</code>, <code>top</code> is defined to be the array index of the first free position in the stack. Thus, an empty stack has <code>top</code> set to 0, the first available free position in the array.",
      "sc6": "Alternatively, <code>top</code> could have been defined to be the index for the top element in the stack, rather than the first free position. If this had been done, the empty list would initialize <code>top</code> as -1."
    }
  }
}
