Question

In: Computer Science

How to find max non-intersecting subset of circles ? (Given center coordinate and radius of each...

How to find max non-intersecting subset of circles ?
(Given center coordinate and radius of each circle)
Need algorithm that better than O(N2)

Solutions

Expert Solution

We can simply reduce this problem to unweighted interval scheduling problem and make it done in O(nlogn) time.

To do this we have to do some manipulation.

THE ALGORITHM FOR THE PROBLEM IS GIVEN BELOW:

1. We are given centre coordinate and radius of each circle. Lets say centres are in (x,0) format. So say array C[] contains the centre coordinates and array R[] contains radius of each circles.

2. Given R[] and C[] we compute the first point and end point of the diameter of each circle. Say S[] contains the starting points of the diameter computed by the formulae (R[i]-C[i]) for all i. Similarly say E[] contains the ending points of the diameter computed by formulae (R[i]+C[i]).

3. Now form a composite array P[] with {S[i], E[i]} pairs for all i.

4. Sort the composite array P[] on the basis of ending points i.e. E[i]'s.

5. Form array NIC[] denoting sets of non intersecting circles. Add P[1] into NIC[].

6. j=1

7. FOR(i=2 to N) // Assuming N is the total number of circles

IF(The starting point of P[i] is less than ending point of P[j])

then continue

Else

j=j+1

Add P[i] to NIC[j+1]

8. NIC[] will contain all the {centre, radius} pairs for the non intersecting circles.

COMPLEXITY ANALYSIS:

Sorting using merge sort will take O(nlogn) time and after that we do a linear scan to eliminate intersecting circles which will take O(n) time. SO overall complexity will be O(nlogn) which better than O(n).


Related Solutions

The figure shows four circles, each with a radius of 6 cm. Find the area of...
The figure shows four circles, each with a radius of 6 cm. Find the area of the region between the circles. (Round your answer to two decimal places.) cm2 A student cuts out a circle from a square piece of cardboard. The circle passes through the midpoints of the sides of a square as shown. Each side of the square has a length of 12 units. What percent of the square cardboard is wasted? (Round your answer to two decimal...
1. Find an equation of the circle that satisfies the given conditions. Center (2, −3); radius...
1. Find an equation of the circle that satisfies the given conditions. Center (2, −3); radius 5 2. Find an equation of the circle that satisfies the given conditions. Center at the origin; passes through (4, 6) 3. Find an equation of the circle that satisfies the given conditions. Center (2, -10); tangent to the x-axis 4. Show that the equation represents a circle by rewriting it in standard form. x² + y²+ 4x − 10y + 28 = 0...
Given two circles C1 and C2 in the same plane where C1 has a radius of...
Given two circles C1 and C2 in the same plane where C1 has a radius of a and C2 has a radius of b and the centers of the C1 and C2 have a distance of c apart. In terms of a,b, and c describe when the intersection of C1 and C2 would be zero points. prove this
The radii of two circles are 8 cm and 6 cm respectively. Find the radius of the circle having area equal to the sum of the areas of the two circles.
The radii of two circles are 8 cm and 6 cm respectively. Find the radius of the circle having area equal to the sum of the areas of the two circles.
A solid conducting sphere of radius a has its center at the origin and non uniform...
A solid conducting sphere of radius a has its center at the origin and non uniform magnetization given by: M = (a*z^2+b)zhat Estimate the vector potential and the magnetic field in the region of space outside the sphere. Calculate the amount of energy stored in the magnetic field outside the sphere. Explain how there can be an H-field associated with this sphere when there are no free currents.
The radii of two circles are 19 cm and 9 cm respectively. Find the radius of the circle which has circumference equal to the sum of the circumferences of the two circles.
The radii of two circles are 19 cm and 9 cm respectively. Find the radius of the circle which has circumference equal to the sum of the circumferences of the two circles.
Find the center and radius of the following sphere: ?^2 + ?^2 + ?^2 + 4x...
Find the center and radius of the following sphere: ?^2 + ?^2 + ?^2 + 4x + 6y = 0
Find the Radius and center of the sphere. 2x2 +2y2 + 2z2 + x + y...
Find the Radius and center of the sphere. 2x2 +2y2 + 2z2 + x + y + z = 9
how to find density when given the radius of a body-centered cubic cell
how to find density when given the radius of a body-centered cubic cell
How to calibrate non-contact CMM(Coordinate Measuring Machine)? Explain in detail.
How to calibrate non-contact CMM(Coordinate Measuring Machine)? Explain in detail.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT