Just a small remark:

On Fri, May 13, 2011 at 6:56 PM, Leopoldo Taravilse <[email protected]>wrote:

> Here's an example
>
> set<int> setint; // you create a set
> setint.insert(4); // you add 4 to the set in o(log n) where n is the number
> of elements of the set
> setint.insert(5); // you add 5 to the set
> setint.insert(4); // nothing happens because 4 is already in the set
> if(setint.find(4)) cout << "4 is in the set" << endl; // you check in o(log
> n) if 4 is in the set, and because it is in the set you print "4 is in the
> set".
> setint.clear(); // you clear the set in o(1).
>

setint.find(4)
returns an iterator -- so you can't use it in an if-clause. You should write
 if(setint.find(4) != setfind.end() )
instead (if the key 4 is NOT found, "find" will compare equal to
setfind.end())

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to