## 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 ?

## need to address a subset of CIA triad elements and not in entirety

Its usually recommended that ‘don’t use your own system of Crypto’ rather use standard SSL/TLS! I understand that SSL/TLS is a complete protocol suite that addresses all three elements of CIA triad. What if I need to use a subset of CIA, say I just need Authentication and Data Integrity. In such a cases isn’t using full SSL/TLS is an overkill?

what’s the issue / risk, if I make and use a customized crypto suite which addresses my specific requirements like in this case for if I just need Authentication and Integrity, I use only digital signing of data with a digital certificate; and skip the encryption part of data (confidentiality is not a concern).

## Intuition of lower bound for finding the minimum of $n$ (distinct) elements is $n-1$ as dealt with in CLRS

I was going through the text Introduction to Algorithms by Cormen et. al. where there was a discussion regarding the fact that finding the minimum of a set of $$n$$ (distinct) elements with $$n-1$$ comparisons is optimal as we cannot do better than it, which means that we need to show that running time of algorithm which finds the minimum of a set of $$n$$ elements is $$\Omega(n)$$.

This is what the text says to justify the lower bound.

We can obtain a lower bound of $$n – 1$$ comparisons for the problem of determining the minimum. Think of any algorithm that determines the minimum as a tournament among the elements. Each comparison is a match in the tournament in which the smaller of the two elements wins. Observing that every element except the winner must lose at least one match, we conclude that $$n-1$$ comparisons are necessary to determine the minimum.

Now I could make the thing out in my own way as:

What I have done is a top down comparison, but the authors by their words "Observing that every element except the winner must lose at least one match, we conclude that $$n-1$$ comparisons are necessary to determine the minimum." seems they are pointing to some bottom up approach which unfortunately I cannot make out.

How,

"That every element except the winner must lose at least one match" $$\implies$$ "$$n-1$$ comparisons are necessary to determine the minimum".

## how to order the elements

Given $$U = \{(p_1,q_1),(p_2,q_2),…., (p_N,q_N)\}$$, where $$0 and $$0, how to solve the following problem:

\begin{align} \max_{S\subseteq U }\max_\sigma&\quad \sum_{i=1}^{|S|}p_{\sigma_i}q_{\sigma_i}\Pi_{j=1}^{i-1}(1-p_{\sigma_j})\ s.t. & \quad |S|=K\le N. \end{align}

where $$\sigma$$ specifies the order of elements in $$S$$.

Suppose that we know the set of $$S$$, then $$\sigma$$ should order the elements by $$q$$. (Otherwise, show the contradiction by switching two elements)

My question is: Suppose that $$(p_n,q_n)$$ lies in $$S^*$$. Then when $$q_n$$ increases, it will still lie in $$S^*$$, but will $$(p_n,q_n)$$ be moved up?

## Delete rows or columns of matrix containing invalid elements, such that a maximum number of valid elements is kept

Originally posted in stack-overflow but was told to post here.

Context: I am doing a PCA on a MxN (N >> M) matrix with some invalid values located in the matrix. I cannot infer these values, so I need to remove all of them, which means I need to delete the whole corresponding row or column. Of course I want to keep the maximum amount of data. The invalid entries represent ~30% of data, but most of it is completly fill in a few lines, few of it is scattered in the rest of the matrix.

Some possible approches:

• Similar to this problem , where I format my matrix such that valid data entries are equal to 1 and invalid entries to a huge negative number. However, all proposed solutions are of exponential complexity and my problem is simpler.

• Computing the ratio (invalid data / valid data) for each row or column, and deleting the highest ratio(s). Recompute the ratios for the sub-matrix and remove the highest(s) ratios. (not sure how many lines or columns we can remove safely in one step), and so on until there is no invalid data left. It seems like an okay solution, but I am unsure it always gives the optimal solution.

My guess is that it is a standard data analysis problem, but surprisingly I could not find a solution online.

## Printing Array elements in the same line

Although I searched a bit on google but did not find a quick and easy answer.

So suppose we have an array with, say 3 elements

X[1]={a,b};X[2]={w,f,s};X[3]={t,y,u}; 

Now I want to print them in the same line using Do loop. I use the code

Do[Print[X[i]],{i,3}] 

But it will print in different lines. I also want to add text in between two elements. I tried to wrap everything using Row[] but it didn’t work.

## Can a Way of the Four Elements Monk cast spells in Wild Shape?

A Monk following the Way of the Four Elements can use Elemental Disciplines. Some of them are actually spells:

Some elemental disciplines allow you to cast spells (PHB 80)

However they are not spellcasters, as evident from the multiclassing section, not even like Eldritch Knights or Arcane Tricksters.

The Monk does not have to have material components, but what about somatic components? If I multiclass into Druid, can I cast these spells while in Wild Shape?

## Would the in-order traversal of the following elements in a binary tree look like this?

The elements are inserted in the following order : 50,45,12,15,60,55,70,65,80.

Following the left-root-right pattern: 70,60,80,45,15,50,55,12,65

Im not sure I got it right from the tree I just drew, would appreciate any help

## Is the empty string and some words of even length are elements of this set?

$$L = \{w \in \{a,b\}^*| \text{the first, the middle, and the last characters of w are identical}\}$$.

I have my answers, but I need confirmation:

Is the empty string $$\epsilon \in L$$? Yes. Reason: there is no first, middle, or last character to break the rule.

Words of even length, assuming the first and last characters of them are identical, again, must be in $$L$$, as there is no middle character to break the rule in such words.

This is in the context of theory of computation by the way.

## Replacement rules which for elements of a vector which meet conditions

I’m trying to create a function which will replace elements of a list with their values modulo 1, i.e. Mod[x,1], but only if Abs[x]>1. So, for example, the function would yield:

f[{-1.5,-1,0,1}]={.5,-1,0,1}].

I’m trying to do this in an elegant way. For example, I have a function for a related purpose:

C1[v_] := v /. _?Negative -> 0;.

This replaces negative elements of a list with 0, and it’s very clean.

I’d like to do something similar. My efforts so far have included breaking it into two functions:

CLim[x_] := Mod[x, 1] /; Abs[x] > 1;

C2[v_] := CQubitLim /@ v; But then, when I apply C2 to a list, it only seems to apply on some elements, for example

C2[{1,0,1.5}]={Clim[1],CLim[0],0.5}

My other idea was to use a conditional rule

v:>Mod[v,1]/;Abs[v]>1

But this doesn’t seem to evaluate when I put a vector through it.

Any ideas much appreciated.