Merge two sorted arrays together
Pass your parameters by const reference to avoid a copy:

std::vector&lt;int&gt; merge2Sorted(std::vector&lt;int&gt; const&amp; left, std::vector&lt;int&gt; const&amp; right)
//                                             ^^^^^^                        ^^^^^^


You are not reservng enough

result.reserve(std::max(left.size(),right.size()));


The result size will eventually be the size of the sum of the two input arrays.

result.reserve(left.size() + right.size());


Your test for left and right can be simplified:

if ( *itLeft &lt; *itRight )
  result.push_back( *itLeft++ );
else
  result.push_back( *itRight++ );
}

// Simplified
// Though I am 50/50 on this one.
result.push_back( ( *itLeft &lt; *itRight ) ? *itLeft++ : *itRight++);


No point in flushing the stream after every print:

std::cout &lt;&lt; i &lt;&lt; std::endl;

                  ^^^^^^^^^^  prefer '\n' unless you really want to force a flush.

std::cout &lt;&lt; i &lt;&lt; '\n';