Data Structures and Algorithms

Language: Python

Challenge Type: ` Code Challenge / Algorithm`

stack-queue-animal-shelter

Code

tests

Challenge12

Create a class called AnimalShelter which holds only dogs and cats. The shelter operates using a first-in, first-out approach.

Whiteboard Process

WhiteBoard

Approach & Efficiency

For the two methods we write them as simple as possible so we can keep the complextiy as samll as possible.

  1. Enqueue
    • Space: O(1)
    • Time: O(1)
  2. Dequeue
    • Space: O(1)
    • Time: O(1)