Stacks and Queues - liz-kavalski-401-advanced-javascript/seattle-javascript-401n13 GitHub Wiki

Stacks

  • A stack is a data structure that has node.
  • Each node reference the next but not the previous.
  • Common terms:
    • Top- The top of the stack
    • Push- Put on top of the stack
    • Pop- To remove from the top of the stack
    • Peek- view the top of the stack.
  • Fellows the "First In, Last Out"/"Last In, First Out"- in other words the top of the stack will be remove first while the bottom of the stack is remove last. Almost like a stack of dishes

Stack

Queues

  • A stack is a data structure that has node.
  • Each node reference the next but not the previous.
  • Common terms:
    • Enqueue - added to the end of the queue.
    • Dequeue - removed from the queue from the front.
    • Front - This is the front/first node of the queue.
    • Rear - This is the rear/last node of the queue.
    • Peek - When you Peek you will view the Top node in the stack.
  • Fellow the "First In, First Out" /"Last In, Last Out"- in other words the first one in is the first one remove, while the last one is remove last. Almost like standing in a line to pay at the store. Queues