I have an algorithm which ,at first, sorts the vector and then iterate through its elements and XOR them. Should I sum the complexities of sort and for loop to calculate the overall algorithm complexity?
So, I have next code:
std::sort(array.begin(), array.end());
for (int i =1; i < array.size(); ++i) {
  result = array[i-1]^array[i];
}
We have a for loop which has O(N) complexity and std::sort which has O(N log N) comparisons on the average.
So the complexity of the next code will be O(N + N log N)?
Or in this case we just have to choose the highest time complexity class which is linearithmic time O(N log N) and don't sum them?
 
     
     
     
     
     
    