A
Amit Bhatia
Hi,
I am not sure if this belongs to this group. Anyway, my question is as
follows: I have a list (STL list) whose elements are pairs of integers (STL
pairs, say objects of class T). When I create a new object of class T, I
would like to check if this object already exists in the list: meaning one
having same integers. This can be done in linear time in a list, and
probably faster if I use STL Set instead of list. I am wondering however if
its possible to do it in constant time, and use list the the same time. I
read something about using lookup function on a hash, but I don't want to go
away from using a list.
Arranging the elements of the list is not important to me, hence a Set is
not exactly what I am looking for.
Thanks,
Amit.
I am not sure if this belongs to this group. Anyway, my question is as
follows: I have a list (STL list) whose elements are pairs of integers (STL
pairs, say objects of class T). When I create a new object of class T, I
would like to check if this object already exists in the list: meaning one
having same integers. This can be done in linear time in a list, and
probably faster if I use STL Set instead of list. I am wondering however if
its possible to do it in constant time, and use list the the same time. I
read something about using lookup function on a hash, but I don't want to go
away from using a list.
Arranging the elements of the list is not important to me, hence a Set is
not exactly what I am looking for.
Thanks,
Amit.