Object-Oriented Programming · Confluent · Hard
Problem Statement Your task is to design a data structure called a RandomQueue. It functions like a standard queue, with one key difference: removal operations extract a random element from the collection instead of the oldest one. Part A: Core Implementation Provide an implementation for the RandomQueue with the following operations: enqueue(x) – adds element x to the queue. dequeue() -> x – removes and returns an element chosen uniformly at random from all currently stored…
Checking your access…