Rewrite the \(\textsc {Merge}\) procedure so that it does not use sentinels, instead stopping once either array \(L\) or \(R\) has had all its elements copied back to \(A\) and then copying the remainder of the other array back into \(A\).

$$\textsc {Merge }(A, p, q, r)$$$$\begin{aligned}1& \quad n_{1}=q-p+1 \\2& \quad n_{2}=r-q \\3& \quad \text {let }L[1..n_{1]}\text { and }R[1..n_{2]}\text { be }\text { new }\text { arrays } \\4& \quad \textbf {for }i=1\textbf { to }n_{1} \\5& \quad \qquad L[i]=A[p+i-1] \\6& \quad \textbf {for }j=1\textbf { to }n_{2} \\7& \quad \qquad R[j]=A[q+j] \\8& \quad i=1 \\9& \quad j=1 \\10& \quad \textbf {for }k=p\textbf { to }r \\11& \quad \qquad \textbf {if }i>n1 \\12& \quad \qquad \qquad A[k]=R[j] \\13& \quad \qquad \qquad j=j+1 \\14& \quad \qquad \textbf {else }\textbf { if }j>n2 \\15& \quad \qquad \qquad A[k]=L[i] \\16& \quad \qquad \qquad i=i+1 \\17& \quad \qquad \textbf {else }\textbf { if }L[i]\leq\,\,R[j] \\18& \quad \qquad \qquad A[k]=L[i] \\19& \quad \qquad \qquad i=i+1 \\20& \quad \qquad \textbf {else } \\21& \quad \qquad \qquad A[k]=R[j] \\22& \quad \qquad \qquad j=j+1 \\\end{aligned}$$