Sorting of vector of vectors.

Let there is a vector of vectors.
vector< vector > vec(n);
Now if i write this
sort(vec.begin(),vec.end());
How the sort function work on this please explain in detail.

1 Like

There’s a different way to sort this kind of vectors.

And you can also follow this link

Please feel free to comment.

Hey @srd091 it actually does work… link here. It would appear that the vectors are being compared lexicographically. This is because the default comparison of vectors is lexicographically, as mentioned here.
@vikas8409 I hope this answers your question.

2 Likes