Does sort(v, v+q) sorts individual vectors at all index or what?
On what basis?
Lexicographical ordering.