added solution for the sorting of the vector