title: Mergesort Seg Fault CONFUSION C++
body: <p>I am in the middle of writing code for merge sort however, I have a seg fault that I have no idea where the origin is. Here is the code:</p>
  <pre><code>// Merge Sort Implementation
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  void merge(vector&lt;int&gt; &amp;v, int left, int mid, int right) {
    int nL = mid - left + 1;
    int nR = right - mid;
    vector&lt;int&gt; L(nL);
    vector&lt;int&gt; R(nR);
  
    for (int i = 0; i &lt; nL; ++i) {
      L[i] = v[left + i];
    }
    for (int j = 0; j &lt; nR; ++j) {
      R[j] = v[mid + 1 + j];
    }
  }
  void merge_sort(vector&lt;int&gt; &amp;v, int start, int end) {
    if (start &lt;= end) {
      int mid = (start + end) / 2;
      merge_sort(v, start, mid);
      merge_sort(v, mid + 1, end);
      // merge(v, start, mid, end);
    }
  }
  
  int main() {
    vector&lt;int&gt; v{2, 1, 5, 7, 9};
    /* vector&lt;int&gt; v{1,   5,  6,  7,  16, 327, 717, 76, 1,  6,
                  177, 17, 53, 69, 2,  0,   4,   3,  32, 27}; */
    int size = v.size();
    merge_sort(v, 0, size - 1);
  
    for (int i : v) {
      printf(&quot;%d &quot;, i);
    }
  }
  </code></pre>
  <p>Commented out parts that I thought would cause this issue including all parts that access elements in the vector. I have also commented out the call to the merge fcn. The problem seems to come from merge_sort().</p>