title: what is threshold in merge sort?
body: <p>i can not understand threshold in merge sort and how can I determine it.
  i google it but no result. can anyone explain it for me?
  i want to sort the array[50000] using merge sort, when threshold crossover using insertion sort. </p>
  
  <pre><code>private int[] MergeSort(int[] lst)
      {
          int hl = lst.Length - 0;
  
          if (hl &lt; 5 || hl &lt; 10 || hl &lt; 15 || hl &lt; 20 || hl &lt; 25 || hl &lt; 30 || hl &lt; 35 || hl &lt; 40 || hl &lt; 45 || hl &lt; 50)
          {
              RunTime run = new RunTime();
              run.X = hl;
              InsertionSort(lst);
              run.Ttime = Process.GetCurrentProcess().TotalProcessorTime.Milliseconds;
  
                  _listRunTime.Add(run);
  
  
  
          }
  
          if (lst.Length == 1)
              return lst;
          int middle = lst.Length / 2;
          int[] left = new int[middle];
          for (int i = 0; i &lt; middle; i++)
          {
              left[i] = lst[i];
          }
          int[] right = new int[lst.Length - middle];
          for (int i = 0; i &lt; lst.Length - middle; i++)
          {
              right[i] = lst[i + middle];
          }
          left = MergeSort(left);
          right = MergeSort(right);
  
          int leftptr = 0;
          int rightptr = 0;
  
          int[] sorted = new int[lst.Length];
          for (int k = 0; k &lt; lst.Length; k++)
          {
              if (rightptr == right.Length || ((leftptr &lt; left.Length) &amp;&amp; (left[leftptr] &lt;= right[rightptr])))
              {
                  sorted[k] = left[leftptr];
                  leftptr++;
              }
              else if (leftptr == left.Length || ((rightptr &lt; right.Length) &amp;&amp; (right[rightptr] &lt;= left[leftptr])))
              {
                  sorted[k] = right[rightptr];
                  rightptr++;
              }
          }
          return sorted;
      }
  
      private void InsertionSort(int[] arr)
      {
          int i, j, tmp;
          for (i = 1; i &lt; arr.Length; i++)
          {
              j = i;
              while (j &gt; 0 &amp;&amp; arr[j - 1] &gt; arr[j])
              {
                  tmp = arr[j];
                  arr[j] = arr[j - 1];
                  arr[j - 1] = tmp;
                  j--;
              }
          }
      }
  </code></pre>
  
  <p>i must use threshold instead of <code>if (hl &lt; 5 || hl &lt; 10 || hl &lt; 15 || hl &lt; 20 || hl &lt; 25 || hl &lt; 30 || hl &lt; 35 || hl &lt; 40 || hl &lt; 45 || hl &lt; 50)</code> .</p>