You have to design and write code for a Data Structure whose skeleton code will look like this. Do not worry about concurrency issues or instantiation etc.
Try to acheive the functionality mentioned for each method.
class BagOfThings {
///it will have following methods
//This method will add one object to the collection.
// It should have constant time complexity
??? add(Object o)
//This method will will remove given object from the collection.
// It should have constant time complexity
??? remove(Object o)
// This method should return num of random objects. The objects from the collection should be picked randomly. They should never be in any order.
// Multiple calling of this method with same value of num, will return different collection each time.
??? getNoOfThings(int num)
}Similar problems: