Be sure to use the online documentation of the algorithms library
http://www.cplusplus.com/reference/algorithm/
Lots of useful examples