The concept was easy.
Deque: Queue with support for Adding/Removing items from either the front or the end.
Randomized Queue: Pop random item when Deque.
Deque.java
1 | import edu.princeton.cs.algs4.StdOut; |
RandomizedQueue.java
1 | import edu.princeton.cs.algs4.StdOut; |