Stack & Queue

Queue

Operations:

  • push: O(1)

  • pop: O(1)

  • Top: O(1)

    Always used for BFS

Stack

Operations:

  • push: O(1)

  • pop: O(1)

  • Top: O(1)

Last updated