Fixed compilation issue with std::sort

-Used a lambda function
-Change container type to vector