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
Post a Comment