2.3.2: algorithms for the main data structures

Cards (9)

  • arre stack FIFO or LIFO
    LIFO
  • Which function adds an item to a stack?
    push
  • Which function removes an element from a stack?
    pop
  • What is the significance of the back pointer in the array representation of a queue?
    Holds the location of the next available space in the queue
  • Which function returns the item at the front of a queue without removing it?
    peek
  • What is the purpose of the front pointer in the array representation of a queue?
    Points to the space containing the first item in the queue
  • What value is the top pointer initialised to in the array representation of a stack?
    -1
  • Give pseudocode for the two functions which add new elements to stacks and queues

    :
  • Which function returns the item at the top of a stack without removing it?
    peek