algorithm - Give two integer vectors in c++ (same size and type), I'd like to sort one from smallest to largest element and change the order of the second vector -


this question has answer here:

give 2 integer vectors in c++ (same size), i'd sort 1 of vectors smallest largest element , change order of second vector respectively.

how can achieve without using boost library?

thanks.

you can restructure code that, instead of 2 vectors of integers, uses vector of s, s structure containing 2 integers. can define specific operator< used sort function.

this has advantage strict coupling between 2 sets of data stated in way stored.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -