The naive approach to solve this problem is by using an array. Elements can be inserted and deleted from an array. Random values from an array can also be fetched by getting a random index first and then retrieving the array element.
The time complexity for this approach will be , but our approach should have a running time of ...
The naive approach to solve this problem is by using an array. Elements can be inserted and deleted from an array. Random values from an array can also be fetched by getting a random index first and then retrieving the array element.
The time complexity for this approach will be , but our approach should have a running time of ...