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
Approach & Efficiency
For the two methods we write them as simple as possible so we can keep the complextiy as samll as possible.
- Enqueue
- Space: O(1)
- Time: O(1)
- Dequeue
- Space: O(1)
- Time: O(1)