Ford Fulkerson

You can use http://www.cplusplus.com/reference/algorithm/reverse/