Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 757 Bytes

File metadata and controls

32 lines (23 loc) · 757 Bytes

Challenge Summary

Create a new class called pseudo queue. Implement our standard queue using two stack instances.

Methods

enqueue

  • Inserts value into the PseudoQueue, using a first-in, first-out approach.

dequeue

  • Extracts a value from the PseudoQueue, using a first-in, first-out approach.

Whiteboard Process

WhiteBoard Solution

Approach & Efficiency

Method Time Complexity Space Complexity
enqueue O(n) O(n)
dequeue O(n) O(n)

Run Solution

# Install dependencies
npm install

# run jest tests for stack-queue-pseudo
npm test stack-queue-pseudo.test.js

Sources

Enqueue & Dequeue - Stack Overflow