@Dave We may use fractions instead of pure double values.
--
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
Don't answer this problem , it's from codechef February challenge !
On Feb 2, 6:11 pm, tech rascal techrascal...@gmail.com wrote:
In a plane given n points (x1,y1) (x2,y2)(xn,yn), find the the
maximum number of collinear points.
plz tell me the best way to do that.
--
You received this
@above
Use Simple Mathematics What is collinear Point...?? what is condition
of collinearity..?? thats it You have done
Three or more points P1, P2, P3, ..., are said to be collinear if they
lie on a single straight line L similarly for N Points ..
Let us start from the Very Basic
@TR: See my algorithm at
http://groups.google.com/group/algogeeks/msg/d329dda12b332dd1.
It is of complexity O(n^2 log n).
Dave
On Feb 2, 7:11 am, tech rascal techrascal...@gmail.com wrote:
In a plane given n points (x1,y1) (x2,y2)(xn,yn), find the the
maximum number of collinear points.
@Dave O(n^2lgn) will exceed given time limit
question contains some constraints, that should be used to overcome time
limit
in general your algorithm is good enough i think !!
On Wed, Feb 2, 2011 at 8:21 PM, Dave dave_and_da...@juno.com wrote:
@TR: See my algorithm at
@Sunny: What are the constraints? I don't see any in the statement of
the problem.
Dave
On Feb 2, 9:37 am, sunny agrawal sunny816.i...@gmail.com wrote:
@Dave O(n^2lgn) will exceed given time limit
question contains some constraints, that should be used to overcome time
limit
in general your
if we just use hashing to store the different slope values
On Wed, Feb 2, 2011 at 7:45 PM, bittu shashank7andr...@gmail.com wrote:
@above
Use Simple Mathematics What is collinear Point...?? what is condition
of collinearity..?? thats it You have done
Three or more points P1, P2, P3,
I wonder U people discuss the solution during the contest ?
On Wed, Feb 2, 2011 at 11:59 PM, Bhavesh agrawal agr.bhav...@gmail.com wrote:
if we just use hashing to store the different slope values
On Wed, Feb 2, 2011 at 7:45 PM, bittu shashank7andr...@gmail.com wrote:
@above
Use
@Bhavesh: The problem with using hashing is that the slopes, being
real numbers, may not have exact representations as floating point
numbers. Thus, slopes that should be identical may differ slightly,
making them hash into different locations in the hash table. When
sorting and comparing adjacent
What contest?
On Feb 2, 12:41 pm, radha krishnan radhakrishnance...@gmail.com
wrote:
I wonder U people discuss the solution during the contest ?
On Wed, Feb 2, 2011 at 11:59 PM, Bhavesh agrawal agr.bhav...@gmail.com
wrote:
if we just use hashing to store the different slope values
http://www.codechef.com/FEB11/
On Thu, Feb 3, 2011 at 12:54 AM, Dave dave_and_da...@juno.com wrote:
What contest?
On Feb 2, 12:41 pm, radha krishnan radhakrishnance...@gmail.com
wrote:
I wonder U people discuss the solution during the contest ?
On Wed, Feb 2, 2011 at 11:59 PM,
first k digits
(unsigned long) floor (pow(10.0,modf(n*log((double)n),dummy)+k-1)
log is on d base 10
last k digits
int func(int n,int k){
int m=1;
for(;k0;k--) m*=10;
r=1; t=n%m;
while(n){
if(n%2)
r=r * t%m;
t=t * t%m;
n=1;
}
return r;
}
--
You received this message because
12 matches
Mail list logo