value of k in any if case would be k=m+n-1, now analyse both of the
options
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

for 1st case k=n+j-1 and j<m so k<m+n-1 which is false
for 2nd case k=m+i-1 and i<n so k<m+n-1 which is also false so both
statement are false

ans:c
correct me if i am wrong
On Jul 26, 8:42 pm, rajeev bharshetty <rajeevr...@gmail.com> wrote:
> C )
>
> On Tue, Jul 26, 2011 at 9:02 PM, Vijay Khandar <vijaykhand...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > Consider the following C-function in which a[n] and b[m] are two
> > sorted integer arrays and c[n+m] be an other integer array.
>
> > 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++];
>
> > }
>
> > 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
>
> > A)only i
> > B)only ii
> > C)either i or ii but not both
> > D)neither i nor ii
>
> > Can I have to take any example....
>
> > --
> > 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.
>
> --
> Regards
> Rajeev N B <http://www.opensourcemania.co.cc>

-- 
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.

Reply via email to