## Finding $l$ subsets such that their intersection has less or equal than $k$ elements NP-complete or in P?

I have a set $$M$$, subsets $$L_1,…,L_m$$ and natural numbers $$k,l\leq m$$.

The problem is:

Are there l unique indices $$1\leq i_1,…,i_l\leq m$$, such that

$$\hspace{5cm}\left|\bigcap_{j=1}^{l} L_{i_{j}}\right| \leq k$$

Now my question is whether this problem is $$NP$$-complete or not. What irritates me is the two constraints $$l$$ and $$k$$ because the NP-complete problems that were conceptually close to it that I took a look on (set cover, vertex cover) only have one constraint respectively that also appears in this problem.

I then tried to write a polynomial time algorithm that looks at which of the sets $$L_1,…,L_m$$ share more than $$k$$ elements with other sets but even if all sets would share more than $$k$$ elements with other this wouldn’t mean that their intersection has more than $$k$$ elements…

This question kind of comes close but in it there is no restriction on the amount of subsets to use and the size of the intersection should be exactly $$k$$, but maybe this could be useful anyways.

Can somebody further enlighten me ?

## How to conceive a Turing machine that is the intersection of the languages of two Turing machines?

We have $$M = (Q,Σ,Γ,δ,q_0,q_a,q_r)$$ and $$M′= (Q′, Σ , Γ′, δ′,q_0′,q_a′,q_r′)$$.

We want to construct a standard Tm that recognize L(M) ∩ L(M′). How do I go about it? I don’t have much more information than this. Anything to get started would be appreciated.

## Intersection of line segments induced by point sets from fixed geometry

I am reading up on algorithms and at the moment looking at the below problem from Jeff Erickson’s book Algorithms.

I solved (a) by seeing a relationship to the previous problem on computing the number of array inversions. However, I am struggling with problem (b) as I cannot see how to reduce the circle point arrangement to an arrangement of points and lines that would be an input to the problem posed in (a). Assuming I have something for (b), I also cannot see how one might resolve (c).

For part (b), clearly every point $$p = (x, y)$$ satisfies $$x^2 + y^2 = 1$$ but I do not see how I might be able to use this fact to do the reduction. The runtime I am shooting for of $$O(n \log^2 n)$$ also seems to tell me the reduction is going to cost something non-trivial to do.

Can anyone have some further hints/insights that might help with part (b) and potentially even part (c)?

## Is the emptiness of intersection of two CFLs decidable?

Consider $$L = \{\langle L_1, L_2\rangle\mid L_1, L_2 \in \text{CFL} \text{ and } L_1 \cap L_2 = \emptyset \}$$. How to prove that $$L \notin R$$?

$$L_1, L_2$$ encoded in chomsky-normal-form.

## Is the BPP class closed for union and intersection?

Just like the title says. I want to prove that given two languages $$L_1,L_2 \in BPP$$, $$L_1 \cup L_2 \in BPP$$ and $$L_1 \cap L_2 \in BPP$$

## Algorithm for intersection point between two vectors

I’m trying to learn Computational Geometry and this formula isn’t obvious to me.
Hint: "cross" is related to the cross product of two vectors .

// returns intersection of infinite lines ab and pq (undefined if they are parallel)     point intersect(center code hereonst point &a, const point &b, const point &p, const point &q)     {         double d1 = cross(p - a, b - a);         double d2 = cross(q - a, b - a);         return (d1 * q - d2 * p) / (d1 - d2);     } 

## 3D intersection algorithm for cylinders

The problem

Input is a list of $$N$$ cylinders in 3D space, and output should be a list of $$M≤N(N-1)/2$$ pairs of cylinders that intersect. ($$M$$ depends on input data, obviously.)

If it matters, the cylinders are very thin (diameter less than 1% of the length for all cylinders), and a solution for “rounded cylinders” would work for me (it probably simplifies the geometry calculations). A “rounded cylinder” is a cylinder with half-spheres at the extremities; formally, for a start point $$S$$, an endpoint $$E$$ and a radius $$r$$, the rounded cylinder $$(S, E, r)$$ is defined as the set $$\{P|∃ Q ∈ [S,E], ||PQ|| ≤ r\}$$.

The obvious solution

It is easy enough to do in $$O(N^2)$$ time and $$O(max(M, N))$$ space: the pseudocode of my current implementation is (for rounded cylinders):

Ncyl = length(cylinder_list) output = {} for i = 1, 2, ... Ncyl:   for j = i+1, i+2, ... Ncyl:     (S1, E1, r1) = cylinder_list[i]     (S2, E2, r2) = cylinder_list[j]     find P∈[S1, E1], Q∈[S2, E2] such that ||PQ|| is minimal  # this is the costly line, says the profiler     if ||PQ|| < r1 + r2:       add (i, j) to output return output 

Better performance?

Any algorithm will have a (time and space) worst-case in $$O(N^2)$$ (at least) because the output list can itself be of that length. However, the above algorithm guarantees $$O(N^2)$$ time even on “friendly” data because it tests all possible intersections.

In my use case, the cylinders are fairly spread apart in space (the longest cylinder is less than one tenth of the diameter of the whole set of cylinders). Furthermore, they occupy a small fraction of space and $$M\sim N$$ (for values of $$N$$ up to 2000 or so, above that it times out). This suggests to me that there could be an improvement by some “sweeping plane” algorithm similar to Bentley-Ottmann. However, I did not find a straightforward way to do Bentley-Ottmann in 3D (in 2D after sweeping you end up ordering points on a line which is easy enough, but in 3D there is no obvious ordering for a plane).

## Maximizing integer sets intersection (with integer delta)

There are two sets of integers with different numbers of items in them.

X= { x_0, x_1, ... x_n }, x_0 < x_1 < ... < x_n Y= { y_0, y_1, ... y_m }, y_0 < y_1 < ... < y_m 

And there is a function of a single integer defined as

F(delta) = CountOfItems( Intersection( X, { y_0+delta, y_1+delta, ... y_m+delta) ) ) 

That is – i add delta integer to every element of the Y and then count how many same integers are in the X and the modified Y.

And then the problem – find delta that maximizes F(delta).

max( F(delta) ), where delta is integer 

Is there some “mathematical” name for such task and optimal algorithm for this? Obviously i can use brute-force here and enumerate all possible combination – but it does not work for big n and m.

## Data structure to query intersection of a line and a set of line segments

We want to pre-process a set of $$n$$ line segments in $$S$$ into a data structure, such that we can answer some queries: Given a query line $$l$$, report how many line segment in $$S$$ dose it intersect.

It is required that the query should be done in $$O(\log{n})$$ time. The data structure itself should take up to $$O(n^{2})$$ storage and be built in $$O(n^{2}\log{n})$$ time. It is suggested that it should be done in dual plane.

I understand that the question may require me to look for the number of double wedge that the a query point is in, but I can’t think of any efficient data structure to report such information. Any suggestions?

This question is basically a homework question from the textbook Computational Geometry by de Berg et al (Question 8.15). I would like to apologize that this question may not be exciting to you.

## Intersection algorithim for finding the intersection points of two arbitrary mathematical curves

I’m looking for an intersection algorithm for finding the intersection points of two arbitrary mathematical curves. Websites like Desmos, GeoGebra, and WolframAlpha allow you to graph and/or input two(Or more but I’m only interested in two) curves to find their intersection points. I know all of the services I’ve listed have some form of API, my problems with those APIs are the technical and practical restrictions. Therefore, I’d like to just use the algorithms they use under the hood. Problem comes when I don’t even know the names of those algorithms or even whether they’re public domain. I’ve done some searching around but I can’t seem to find what I’m looking for. So I guess what I’m asking for are some basic design descriptions/requirements for these algorithms so I can implement one of them. I figured this problem wasn’t really a question for the mathematics StackExchange or StackOverflow So I decided to place it here. Let me know if that’s a problem.