Question: public interface RandomizedList extends List ( t x * Adds the specified element to this list. void add(T element); *Selects and removes an element selected
public interface RandomizedList extends List ( t x * Adds the specified element to this list. void add(T element); *Selects and removes an element selected * uniformly at random from the elements * currently in the list. T remove O; * Selects but does not remove an element * selected uniformly at random from the * elements currently in the list. T sampleO; Suppose that the following performance guarantees are make for a particular implementing class for this interface. remove: 0(1) sample: o(1) Which data structure is being used in this implementing class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
