Consider the following initialization step of loop invariant for merge procedure

Initialization: Prior to the first iteration of the loop, we have $k=p$, so that the subarray $A[p .. k - 1]$ is empty. This empty subarray contains the k- p= 0 smallest elements of $L$ and $R$, and since $i = j = 1$, both $L[i]$ and $R[j]$ are the smallest elements of their arrays that have not been copied back into $A$.

I have doubt in the above statement that if $k=p$, then array $A[p..p-1]$ is impossible and hence the further argument cannot proceed, which didn't happen. Where am I going wrong?

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 cs.stackexchange
scroll top