int B[sizeof(A)];
int k=0 , j ;
for(j=i;j<n;j++)
{
 if (A[j] < A[i])
  B[k++]=A[j];
}


On Tue, Oct 4, 2011 at 5:30 AM, Abraham <freedomsou...@gmail.com> wrote:

> Hi Vikram!
> Obviously The naivest solution is O(n2). Could you give a hint for
> this problem?
>
>
> On Oct 3, 4:39 pm, Vikram Singh <singhvikram...@gmail.com> wrote:
> > Given an array say A=(4,3,1,2). An array B is formed out of this in
> > such a way that B[i] = no. of elements in A, occuring on rhs of A[i],
> > which are less then A[i].
> > eg.for the A given, B is (3,2,0,0).
> > Here A of length n only contains elements from 1 to n that too
> > distinct..
> > Now the problem is:
> > 1). You are given with any such A. Find out corresponding B?
> >
> > 2). You are given with any such B. Find out corresponding A?
> >
> > Please provide solution in O(n),if possible??
>
> --
> 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.
>
>

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