If you do this over and over you might benefit from having the set sorted in a tree. That woudl give you lg(n) lookup but you would have to do a bit more work when you add new elements. Johan