[algogeeks] Sieve

2012-12-07 Thread Don
I know that the Sieve of Eratosthenes is a fast way to find all prime numbers in a given range. I noticed that one implementation of a sieve spends a lot of time marking multiples of small primes as composite. For example, it takes 1000 times as long to mark off all of the multiples of five as it t

[algogeeks] Re: Is a point inside a polygon?

2012-12-07 Thread Don
Yes, this is a good solution. In implementing this it is important to take care that a ray which passes through a vertex counts as intersecting the polygon exactly once. Don On Dec 6, 12:45 am, "Karthikeyan V.B" wrote: > Find the number of intersections for a ray passing from the exterior of the

Re: [algogeeks] Is a point inside a polygon?

2012-12-07 Thread shiva@Algo
draw any ray through the point. the ray cuts the polygon at several places on both sides of the point. if the no off cuts @ both side is odd point lie inside the polygon else outside the polygon. Plz see the example in the attached PDF. On Thu, Dec 6, 2012 at 9:48 AM, shivendra singh wrote

[algogeeks] Re: HOW TO CALCULATE THA size of union

2012-12-07 Thread Don
The actual size is system dependent because the language doesn't specify the size of int or long int. I'll assuming the common convention that sizeof(int)=4 and sizeof(long int)=8. The size of a union is the size of the largest element in the union. So sizeof(D) = 5*sizeof(int)=20 C and B will be t

[algogeeks] HOW TO CALCULATE THA size of union

2012-12-07 Thread zerobyzero
what will be the size of union A ,B,C and D. also please explain the logic. * union A{* * long int y[5];* * union B{* *double g;* *union C{* * int k;* * union D{* *char ch;* *

Re: [algogeeks] Is a point inside a polygon?

2012-12-07 Thread shivendra singh
Point-In-Polygon Algorithm On Thu, Dec 6, 2012 at 3:54 AM, Don wrote: > Given a simple polygon (specified by a list of the vertices) and a > point, how do you determine if the point is inside the polygon? > > -- > > > --

Re: [algogeeks] Is a point inside a polygon?

2012-12-07 Thread Karthikeyan V.B
Find the number of intersections for a ray passing from the exterior of the polygon to the point needed. If odd, the point lies inside the polygon. If even, the point lies outside the polygon. On Thu, Dec 6, 2012 at 3:54 AM, Don wrote: > Given a simple polygon (specified by a list of the verti

Re: [algogeeks] YAhoo PlacementPaper Friends

2012-12-07 Thread Vikalap Mahajan
http://beautifultesting.blogspot.com/ On Sun, Dec 2, 2012 at 9:38 PM, vamshi vijay wrote: > > Hi Friends.. > > http://www.iitplacementpapers.com/2012/09/yahoo-campus-placement-papers-iits-nits.html > -- > With Regards, > N.Vamshi Vijay, > Mtech,CSE, IIT Kharagpur, > Software Developer, Amazon In