hi > void XYZ(int a[],int b[], int c[]) > { > int i,j,k; > i=j=k=0; > while((i<n)&&(j<m)) > { > if (a[i]<b[j]) > c[k++]=a[i++]; > else > c[k++]=b[j++]; >0 > }
In this case either i value or j value is incremented at a time in an iteration . So its impossible that both the conditions (i< n) and (j<m) fails. So either of them must fail . If (i<n) fails that means i=n and j < m and k=n+j-1 and that means that i has been incremented in the last iteration . so a[i] < b[j] in the last iteration .this means a[n-1] < b[j]. Similarly if (j<m) fails then i < n and k = m_i-1 and b[m-1] <=a[j] > > Which of the following condition(s) hold(s) after the termination of > the while loop? > > i)j<m, k=n+j-1, and a[n-1]<b[j] if i=n > > ii)i<n,k=m+i-1, and b[m-`1]<=a[i] if j=m Thus either one or two . but not both . If both are true then the loop wont be exited Regards Sasi kumar T -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.