Re: [algogeeks] Re: Minimum Triplet Distance

2010-12-22 Thread Priyanka Chatterjee
@SOURABH:As explained correctly by *Yq* ,it's a greedy approach., when u
find the min(x,y,z) and take with difference with max(x,y,z) to find the
triplet distance, you see that if you consider that min(x,y,z) with other
tuples of the other two variables , the max difference either remains same
or increases as the arrays are sorted in nondecreasing order. As you are
asked to find the minimum of such max difference(triplet distance) ,, its
meaningless to find out the triplet difference >= current triplet
difference. So to discard that path we increment the index of smallest
variable by one.

@Nikhil/Swapnil: No point discussing O(1) . It's never possible better than
O(n1+n2+n3).

On 21 December 2010 02:10, Saurabh Koar  wrote:

> @yq: Can u plzz inform what was ur approach/logic while deriving the
> condition that "index will be increased of that array which contains
> minimum of three elements to get the desired ans"?
> It will be very helpful.Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>
>


-- 
Thanks & Regards,
Priyanka Chatterjee
Final Year Undergraduate Student,
Computer Science & Engineering,
National Institute Of Technology,Durgapur
India
http://priyanka-nit.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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.



Re: [algogeeks] Re: Minimum Triplet Distance

2010-12-21 Thread Nikhil Agarwal
@Swapnil I got a counter example for my approach.By O(8) i mean O(c) c: a
constant leading to O(1).

On Tue, Dec 21, 2010 at 2:10 AM, Saurabh Koar wrote:

> @yq: Can u plzz inform what was ur approach/logic while deriving the
> condition that "index will be increased of that array which contains
> minimum of three elements to get the desired ans"?
> It will be very helpful.Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>
>


-- 
Thanks & Regards
Nikhil Agarwal
Senior Undergraduate
Computer Science & Engineering,
National Institute Of Technology, Durgapur,India
http://tech-nikk.blogspot.com
http://beta.freshersworld.com/communities/nitd

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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.



Re: [algogeeks] Re: Minimum Triplet Distance

2010-12-20 Thread Saurabh Koar
@yq: Can u plzz inform what was ur approach/logic while deriving the
condition that "index will be increased of that array which contains
minimum of three elements to get the desired ans"?
It will be very helpful.Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Minimum Triplet Distance

2010-12-20 Thread nitdgp
@Nikhil - Not sure on what you mean by O(8). And O(1) doesn't work
anyway.

-Swapnil

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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.



Re: [algogeeks] Re: Minimum Triplet Distance

2010-12-20 Thread yq Zhang
@dave&saura, i dont understand what did you mean.

Sent from Nexus one
On Dec 20, 2010 6:13 AM, "Saurabh Koar"  wrote:
> @Dave : Ya I understand.Thank u.
> @yq: Sorry!! :(
>
> --
> You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
> To post to this group, send email to algoge...@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 algoge...@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.



Re: [algogeeks] Re: Minimum Triplet Distance

2010-12-20 Thread Saurabh Koar
@Dave : Ya I understand.Thank u.
@yq: Sorry!! :(

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Minimum Triplet Distance

2010-12-20 Thread Dave
@Saurabh: This response is pretty surly for someone asking for free
help.

Dave

On Dec 19, 11:51 pm, Saurabh Koar  wrote:
> @yq: Heyy yq..I m not interested in what is equivalent to what and
> what is not not equivalent to what..I m interested to a specific
> optimized algorithm for the specific problem stated above.If u can
> figure out equivalence u can also devise the algorithm for the above
> problem.Nw would u please state that??or provide any link??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Minimum Triplet Distance

2010-12-20 Thread Nik_nitdgp
I have a solution.I cant prove the correctness but by intuition I can
conclude.This is O(1) solution.

As we have 3 sorted arrays A,B,C.So only first and last element of
these 3 lists will be contributing for min/max tuple.Rest elements
will be varying from that max to min.

Suppose a={-1,-1,0}
b={-1,3,7,8,10}
c={0,1,2,3,4,5}

so -1,0 of A ,-1,10 of B and 0,5 of C will be contributing .So we find
all possible 8 tuples.Find minimum of these tuples.That will be the
answer.Solution if O(8) equilvalent to O(1).Please provide counter if
you can find.

On Dec 20, 11:13 am, yq Zhang  wrote:
> ok. Suppose you have 3 pointers i, j, k point to the element in A, B, C
> respectively. Initialize i = j =k = 0.
> for each step, you will compare A[i], B[j], C[k].
> if A[i] is the smallest, i++
> if B[j] is the smallest, j++
> if C[k] is the smallest, k++
> (this assumes numbers in A,B,C are unique, you should be able to eliminate
> this restriction by changing above logic a little bit.)
>
> for each step compute the current triple distance and keep the minimum.
>
> Thanks
>
> On Sun, Dec 19, 2010 at 9:51 PM, Saurabh Koar wrote:
>
>
>
>
>
>
>
> > @yq: Heyy yq..I m not interested in what is equivalent to what and
> > what is not not equivalent to what..I m interested to a specific
> > optimized algorithm for the specific problem stated above.If u can
> > figure out equivalence u can also devise the algorithm for the above
> > problem.Nw would u please state that??or provide any link??
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com > .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 algoge...@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.