[algogeeks] Re: Array Problem??

2011-10-03 Thread Abraham
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  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.



[algogeeks] Re: Amazon -> array problem

2011-09-30 Thread Abraham
Can we replace the operator (/) with 1^(-n) ?

On Sep 30, 12:54 pm, raju  wrote:
> @nitin ..
> Output array is not a new array ... you can do anything to input array ..
>
> ~raju
>
> On Fri, Sep 30, 2011 at 1:24 PM, Nitin Garg wrote:
>
>
>
>
>
>
>
> > Can we assume the output array is a new array and we can distort the
> > originial array???
>
> > On Fri, Sep 30, 2011 at 9:14 AM, praveen raj wrote:
>
> >> Take two array... one will take care of left products... and othr will
> >> take care of right product.. at any index left[i]=A[i-1]*left[i-1]
> >> starting from left and right[i]= A[i+1]*right[i+1] starting frm right……
>
> >> --
> >> 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.
>
> > --
> > Nitin Garg
>
> > "Personality can open doors, but only Character can keep them open"
>
> > --
> > 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.