Eldritch Smite: Can you decide whether the enemy goes prone or do they always go prone?

Once per turn when you hit a creature with your pact weapon, you can expend a warlock spell slot to deal an extra 1d8 force damage to the target, plus another 1d8 per level of the spell slot, and you can knock the target prone if it is Huge or smaller.

Since it says "can knock the target prone." I assumed it was optional, (though you wouldn’t have much reason not to if in melee, within 5 ft.)

Provide a polynomial time algorithm that decides whether or not the language recognized by some input DFA consists entirely of palindromes

Everything needed to know is in the question statement. I believe that the DFA has to be acyclic (meaning its language is finite), which can be checked in polynomial time. However, finding all paths from the start state to an accept state can run in exponential time in worst-case.

Is there a way to determine whether a list of integers can be a prefix function?

Say you had




Could you use, for example, the KMP algorithm to deduce the validity of the above lists as prefix functions? I know there is a way to find whether a substring exists in a string using KMP, but is there a way to do it the other way around, starting at the apparent prefix function and ascertaining that it is indeed a possible prefix function, without knowing the string/substring itself at the start?

checking whether turing machine passes at least k>2 states before accepting a word

$ L=\{<M,k>|\exists\,\,w\in L(M)\,\,such\,\,that\,\,M\,\,passes\,\,at\,\,least\,\,k>2\,\,distinct\,\,states\,\,before\,\,accepting\,\,w\}$

I try to think of reduction to prove that this language is neither RE nor coRE. How to approach this problem? Is there a hint, or intuition?

I usually check whether Rice can be used, but the question here is not about the language itself

Given an algorithm, decide whether it runs in polynomial time?

This problem is not decidable (reducible to halting problem) but is semi-decidable and therefor verifiable (as those two definitions are equivalent: How to prove semi-decidable = verifiable?).

However, is this problem poly-time verifiable? A decision problem 𝑄 is in poly time verifiable iff

there is an algorithm 𝑉 called verifier such that V runs in $ O(x^{c})$ for some constant c for all inputs π‘₯,

if 𝑄(π‘₯)=π‘ŒπΈπ‘† then there is a string 𝑦 such that 𝑉(π‘₯,𝑦)=π‘ŒπΈπ‘†, if 𝑄(π‘₯)=𝑁𝑂 then for all strings 𝑦, 𝑉(π‘₯,𝑦)=𝑁𝑂.

Example: for an enumeration of P (such as this): How does an enumerator for machines for languages work? for each string $ p$ in the enumeration, does there exist some other string (certificate) $ c$ that allows you to verify $ p$ is a member of the enumeration in poly time?

Determine whether given f is shortest path function

I have the following question: Let $ G = (V,E)$ be a directed graph with a weight function $ w:E\rightarrow \mathbb{R}^+$ , and let $ s \in V$ be a vertex such that there is a path from $ v$ to every other vertex, i.e $ 0\leq dist(s,v) < \infty$ . Let $ f\colon V \to \mathbb R$ a given function. Describe an algorithm that runs in $ O(|V| + |E|)$ that determines wethter this given $ f$ is the shortest path function from $ s$ , i.e $ \forall v \in V :f(v)=dist(s,v)$ .

What I thought about was to check for every $ v \in V$ whether $ f$ fulfill the two following demands:

  1. $ f(s)=0$
  2. $ f(v) \leq f(u) + w(uv)$ for all $ u \in V$ and $ uv \in E$

This runs in the proper complexity. I thought to prove it by showing that $ f(v) \leq dist(s,v) \land f(v) \geq dist(u,v) \Rightarrow f(v) = dist(f,v)$

I proved that $ f(v) \leq dist(s,v)$ , but I am stuck at proving that $ f(v) \geq dist(s,v)$ .

Decide whether two strings $x, y$ can be split into substrings $a,b,c$ such that $x=abc$ and $y=cba$

What is the fastest algorithm for the following problem?

Given two strings $ x, y \in \Sigma^*$ as input, decide whether there exists strings $ a, b, c \in \Sigma^*$ , such that $ x=abc$ and $ y=cba$ .

By calculating all the length of the longest common prefix of $ s = x$ y$ and all suffixes of $ s$ , we can compute all candidates for $ a$ in $ O(n)$ time.

For each candidate of $ a$ with length $ k$ , we now just need to check whether $ x_k, x_{k + 1}, \ldots, x_{n}$ is a rotation of $ y_0, y_1, \ldots, y_{n – k}$ . This can of course be done in $ O(n)$ .

However checking the rotations naively results in a worst-case $ O(n^2)$ algorithm.

It seems that using the result from either https://arxiv.org/pdf/1601.08051.pdf or https://arxiv.org/pdf/1311.6235.pdf would make the algorithm run in expected $ O(n)$ time.

Is there a simpler way of speeding up the rotation checking, where it is still faster than $ O(n^2)$ ? Is there a way of making it deterministic, so that it still runs in $ O(n)$ time?