Thanku Sasi .............

On Tue, Jul 26, 2011 at 10:49 PM, sasi kumar <[email protected]> wrote:

> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to