previous | start | next

Which Data Structure

Suppose we will need these operations (and only these) on data to be stored and all operations must have the indicated running time restriction:

  1. insert(x) - must be O(log(N), preferably O(1)
  2. contains(x) - must be O(1)

A class is to be written with these public methods. A private data member will store the actual data and be used to implement the public methods.

Which type could be used for the private data member?



previous | start | next