Skip to content

Latest commit

 

History

History
49 lines (27 loc) · 882 Bytes

401-10.md

File metadata and controls

49 lines (27 loc) · 882 Bytes
layout title permalink
page
401.10 Reading Notes
/401-R10/

Stacks & Queues

Stacks

  • Stacks are Node-based data structures with some similarities to and some distinctions from linked lists. Nodes have references to the subsequent node.

  • Stack vocabulary:

    • Push into the stack

    • Pop out of a stack

    • Top of the stack is the most recently pushed node (and first to be popped out)

    • Peek at the top of the stack

  • Stack principles:

    • First-in, last-out (and vice-versa)

    • Bottom node references "null"

Queues

  • Queues are another "directional" data structure.

  • Common queue vocabulary:

    • Enque nodes to add to the queue

    • Dequeue nodes to remove from queue

    • Front first Node

    • Rear last Node

    • Peek at the front Node's held value

  • Queue principles:

    • First-in, first-out

    • Last-in, Last-out