instruction
stringlengths
0
29.8k
⌀
|time-complexity|recurrence-relation|
**Why it works** This trick would work for any recurrence relation satisfies $$T(3 n) = \Theta(T(3n)) \qquad \qquad (Cond.)$$ which holds if it belongs to polynomial family $T(n)=O(n^p)$ for constant $p$. If $T(n)$ obeys this condition, for all numbers $n$ there is $k$ such that $3^k\le n< 3^{k+1}$ and we have $$...
**When does it work?** This trick would work if $T(n)$ satisfies $$T(3 n) = \Theta(T(3n)) \qquad \qquad (Cond.)$$ which holds if it belongs to polynomial family. If $T(n)$ obeys this condition, for all numbers $n$ there is $k$ such that $3^k\le n< 3^{k+1}$ and we have $$3^k\le n< 3^{k+1}\implies T(3^k)\lesssim T(...
**When does it work?** This trick would work if $T(n)$ satisfies $$T(3 n) = \Theta(T(3n)) \qquad \qquad (Cond.)$$ which holds if it belongs to polynomial family, which is the case when $T(n)=O(a T(n/b)) +O(n)$ for constants $a,b=O(1),b>1$. Observe that for all numbers $n$ there is $k$ such that $3^k\le n< 3^{k+1}$ ...
A Hopfield (neural) network is introduced <!-- by that book, *Algorithm Design* by Jon Kleinberg and Éva Tardos --> as an **undirected** network satisfying some conditions in that book. The book also introduces a **directed** Hopfield network exactly as a Hopfield network, except that "each edge is directed, and ea...
Because a halt decider must compute the mapping from its inputs to an accept or reject state on the basis of the actual behavior of its actual inputs, when H is a simulating halt decider H(P,P) would return 0 on the basis that its input specifies infinitely nested simulation that never reaches its "ret" instruction. ...
**The following concrete example shows that the confounding input is aborted before it ever receives any return value from the halt decider. The simulating halt decider H aborts its input because this input specifies infinite invocations comparable to infinite recursion.** When a simulating halt decider must abort ...
_P() [00000b1a](01) 55 push ebp [00000b1b](02) 8bec mov ebp,esp [00000b1d](01) 51 push ecx [00000b1e](03) 8b4508 mov eax,[ebp+08] [00000b21](01) 50 push eax // 2nd Param [00000b22](03) 8b4d08 mov ecx,[ebp+0...
> Let a,b,c be arbitrary nodes in the subtrees $\alpha$, $\beta$, > $\gamma$, respectively, in the left tree of Figure 13.2. How do the > depths of a,b,c change when a left rotation is performed on node x in > the figure (figure 13.2 given below)? [![figure 13,2][1]][1] **My answer:** Since in the left ...
How does depths of nodes change after left-rotation in a BST (Exercise question from Cormen)
null
> Let a,b,c be arbitrary nodes in the subtrees $\alpha$, $\beta$, $\gamma$, respectively, in the left tree of Figure 13.2 (that is given below). How do the depths of a,b,c change when a left rotation is performed on node x in the figure? > >[![figure 13,2][1]][1] [Here][2] is a snapshot of the original question. ...
>Prove that there does not exist a universal Turing machine that takes a pair $\langle M, w\rangle$ as input, where M is a Turing machine and w is a string, and that always halts, accepts if $M$ accepts $w$, and rejects if $M$ reject w. I think assuming the existence of such a machine H could allow one to decide th...
a halting turing machine
|complexity-theory|turing-machines|undecidability|halting-problem|
I have two sets of points in space with known positions: $$A = \{r_1^{\alpha}, r_2^{\alpha}, ..., r_n^{\alpha}\} \quad n \in \mathbb{N}, \quad r_i^{\alpha} \in \mathbb{R^3}$$ $$B = \{r_1^{\beta}, r_2^{\beta}, ..., r_m^{\beta}\} \quad m \in \mathbb{N}, \quad r_i^{\beta} \in \mathbb{R^3}$$ $$m < n$$ I want to...
Combinatorics under constraints
|trees|combinatorics|
A Hopfield (neural) network is introduced <!-- by that book, *Algorithm Design* by Jon Kleinberg and Éva Tardos --> as an **undirected** network satisfying some conditions in that book. The book also introduces a **directed** Hopfield network exactly as a Hopfield network, except that "each edge is directed, and ea...
The answer is "no". Let $L$ be an arbitrary regular language such that $\rho_L(n) \leq b^n$ with $b \leq |\Sigma|$. Assume there exists such a regular language $L'$ with $L \subseteq L'$ and $\rho_{L'}(n) = b^n$. Then, by closure properties of regular languages, the language $L' \setminus L$ is also regular, with densi...
null
**For finite state machines:** Since the non-determinstic behaviour can be simulated via the deterministic version of the machine where new states are created for all possible combinations of simultaneous states of the non-determinstic one. There is no added computational power for reaching for the non-deterministic...
[Proof of concept](https://en.wikipedia.org/wiki/Halting_problem#Proof_concept) referenced by Nathaniel tells that the idea for a contradiction resulting from assuming a decider $\text{halts}$ that decides the halting problem is to construct a Turing machine $g$ that "does the opposite of what $\text{halts}$ says $g$ s...
null
null
Let's say I visit an IP Checker online, is the OP shown there my IP or the IP of my router? I can't seem to find a conclusive authoritative answer online.
Is IP a property of the device one uses or the router through which one connects to the internet?
|ip|
Conceptually, I suggest an approach like this: - For each rule $r$: - Check whether it is linearly dependent on the preceding rules. If it is, output the linear dependence and remove $r$ from the set of rules. To help us do this, we can note that a rule whose condition is of the form `A && B` can only depen...
null
It depends on how your network is configured. Since you talk about a router, most domestic users have a public IPv4 assigned to their router and then a private subnetwork for all the home devices. The router is used as a gateway to the internet and it handles translating the private addresses to the public address ...
null
null
It depends on how your network is configured. Since you talk about a router, most domestic users have a public IPv4 assigned to their router and then a private subnetwork for all the home devices. The router is used as a gateway to the internet and it handles translating the private addresses to the public address ...
Unfortunately, if $\mathsf{P} \neq \mathsf{NP}$, there is no efficient algorithm that solves your problem. An algorithm that is able to solve your problem could be used to solve (the decision version of) the maximum independent set problem on unit disk graphs, which [is known to be $\mathsf{NP}$-hard](https://www.s...
null
I am a CS student. I am looking at some questions my professor made and I got stuck in this one. \ "Which one of the following inclusions between complexity classes is coherent with the current knowledge? (even if not proved, yet)". The possible answers are: - P $\subseteq$ EXP (Which I know it is true) - NP $\...
Given the current knowledge about complexity class, what can we say?
|complexity-theory|time-complexity|np|complexity-classes|
Notice that the question is not asking for inclusions that are known to be true, but instead just for those that **could conceivably** be true given the current knowledge. In other words you need to select both the relations that are already known to be true and the relations whose status is still unknown. The in...
**Hint:** About MergeSort: $$1000=500+500\\ 500 = 250+250\\ 250=125+125\\ 125=63+62\\ 63=32+31\\ 32=16+16\\ 16=8+8\\ 8=4+4\\ 4=2+2\\ 2=1+1$$ Do you understand the pattern ?
While porting an algorithm, I having a bit of a problem with finding an efficient algorithm for finding a linear combination of piecewise functions. The procedure is described in the Table 3 of the appendix of the SIRUS algorithm by Bénard et al. (https://proceedings.mlr.press/v130/benard21a.html). The problem is de...
I am having two algorithms, of which the second is a refinement of the first. However, I am having trouble to show that the seemingly better algorithm runs at least as fast as the first algorithm. The algorithms aim to be FPT with respect to the parameter $k$ for the following problem: Circle-Cover:<br> Input: ...
k-Circle Cover - How to show the faster algorithm isn't slower
|runtime-analysis|
I am having two algorithms, of which the second is a refinement of the first. However, I am having trouble to show that the seemingly better algorithm runs at least as fast as the first algorithm. The algorithms aim to be FPT with respect to the parameter $k$ for the following problem: Circle-Cover:<br> Input: ...
I am having two algorithms, of which the second is a refinement of the first. However, I am having trouble to show that the seemingly better algorithm runs at least as fast as the first algorithm. The algorithms aim to be FPT with respect to the parameter $k$ for the following problem: Circle-Cover:<br> Input: ...
Consider two finite languages, $L_A$ and $L_B$, potentially over different alphabets. Now since these languages are finite, there exist minimal acyclic deterministic finite-state automata to decide them. We are given that $L_A$ is bigger than $L_B$: $|L_A| > |L_B|$. We are given a function $f$ which maps elements of...
Myhill-Nerode equivalence under a function
|regular-languages|finite-automata|
As far as I understand it, computation today is largely based on Turing machines implemented in von Neuman architectures. Are there other realizations of Turing machines in use or being considered theoretically that would be advantageous in any way? Or even non-Turing ones that may somehow scale? It seems to me that co...
Are there any other useful computational architectures than von Neuman based ones?
|turing-machines|computation-models|
null
null
Yes, [(1)](https://cs.stackexchange.com/questions/152827/myhill-nerode-equivalence-under-a-function#mjx-eqn-eq1) and [(2)](https://cs.stackexchange.com/questions/152827/myhill-nerode-equivalence-under-a-function#mjx-eqn-eq2) imply formula [(3)](https://cs.stackexchange.com/questions/152827/myhill-nerode-equivalence-un...
In a recent presentation, I've seen the difficulty of NP-complete/NP-hard problems attributed to the fact that they often have "long range" correlations, or at least they can be interpreted that way when the problem is mapped onto a physical system. For instance, in 3SAT a variable appearing in a given clause may also ...
Do non-linear dynamical systems have the potential to have an edge on other algorithms when it comes to computing NP-complete problems?
|complexity-theory|np-complete|np-hard|3-sat|physics|
I was wondering if, given an algorithm for 3SAT, testing it on Barthel instances would provide a general idea of how well it empirically performs on hard instances. What would other hard instances look like that would perhaps be more telling?
Are Barthel instances good to use as benchmark for "hard" instances of 3SAT?
|3-sat|
I have the following idea: Suppose a device D performing a set of tasks T1-Tn. Each task Ti has 3 properties: time of execution(E), amount of memory needed(M) and priority(P). `Ti: <E=1s, M=45kB, P=0>` Each of these properties is given a grade value ranging from 0-10 based on the property's value. e.g.,: `Ti gr...
What is the name of the problem or technique used to quantify a given entity based on its properties?
|terminology|
I have the following idea: Suppose a device D performing a set of tasks T1-Tn. Each task Ti has 3 properties: time of execution(E), amount of memory needed(M) and priority(P). `Ti: <E=1s, M=45kB, P=0>`. Each of these properties is given a grade value ranging from 0-10 based on the property's value. e.g.,: `Ti...
A "bigger estimation" is expressed the inequation $$3-\frac 7n>3-\epsilon,$$ which is solved by $$n>\frac 7\epsilon.$$
Question about epsilon and estimation Turing machines
These are two paragraphs from the book CLRS: In the rod-cutting problem, an optimal solution for cutting up a rod of size $n$ uses just one subproblem (of size $n - i$), but we must consider $n$ choices for $i$ in order to determine which one yields an optimal solution. Informally, the running time of a dynamic...
Number of subproblems
|algorithms|
These are three paragraphs from the book CLRS: The rod-cutting problem is the following. Given a rod of length $n$ inches and a table of prices $p_i$ for $i = 1, 2, ..., n$, determine the maximum revenue $r_n$ obtainable by cutting up the rod and selling the pieces. In the rod-cutting problem, an optimal solution...
These are three paragraphs from the book CLRS: The rod-cutting problem is the following. Given a rod of length $n$ inches and a table of prices $p_i$ for $i = 1, 2, ..., n$, determine the maximum revenue $r_n$ obtainable by cutting up the rod and selling the pieces. In the rod-cutting problem, an optimal solution...
null
null
**Hint**: Construct a poly-time verifier for ${L_{1}}^{c}$ by using $L_2$'s verifier, in addition to running some polynomial-time checks.
Actually, there is a simple optimal greedy strategy with these prices: "Don't cut if n ≤ 3. Cut a piece of length 2 if n = 4 and cut a piece of length 3 otherwise, then cut the rest according to this strategy". Here's two interesting problems: 1. Given 4 prices, find out if the originally proposed greedy algori...
null
Suppose I have a directed acyclic graph $G$. I want to find a graph $H$ containing the nodes of $G$ (and potentially more) which minimizes the number of edges in the graph, without changing the reachability between the nodes of $G$. That is, if a path from $s$ to $t$ exists in $G$ a path from $s$ to $t$ must also exist...
Minimize edge count in directed graph, allowing auxiliary nodes
|graphs|optimization|
Skiena's Algorithm Design Manual, 3rd Ed p.71 gives the time complexity of a *dynamic array* according to the number of movements, $M$, as: $$ M = n + \sum_{i=1}^{lg(n)} 2^{i-1} = 1 +2+ 4+\ldots+\frac{n}{2} + n \stackrel{?}{=} \sum_{i=0}^{lg(n)} \frac{n}{2^i} $$ For the life of me, I can't figure out how he's g...
Big O of dynamic array
|summation|dynamic-array|
If we assume that $n$ is a power of two (I'm assuming the author assumes this), first we can rewrite $n$ as a power of two, and shift the index over by one. Then we can combine the two into one sum: $$n + \sum_{i=1}^{\lg(n)} 2^{i-1} = 2^{\lg(n)} + \sum_{i=0}^{\lg(n)-1} 2^{i} = \sum_{i=0}^{\lg(n)} 2^{i}$$ For st...
With $n=2^k$, $$2^k+2^{k-1}+2^{k-2}+\cdots 1=2^k\left(1+\frac12+\frac14+\cdots\right)\sim 2^k\,2.$$
$$n+\frac n2+\frac n4\cdots \frac nn=n\left(1+\frac12+\frac14+\cdots\right)\sim n\,2.$$
For a given recursive language $L$, let $TL$ be the language of turing machines that accept $L$, for some encoding of turing machines. $TL$ is countably infinite. Does there exist a set $S = \{S_1,S_2,\cdots\}$ of computable functions that take as input a turing machine and output a turing machine, such that if $T$ is ...
Nonexistance of collection of 'transformers' that 'trivially modify' Turing machines?
|formal-languages|turing-machines|
null
As far as I understand it, computation today is largely based on Turing machines implemented in von Neuman architectures. Are there other realizations of Turing machines in use or being considered theoretically that would be advantageous in any way? Or even non-Turing ones that may somehow scale? It seems to me that co...
null
Suppose I have a directed acyclic graph $G$. I want to find a graph $H$ containing the nodes of $G$ (and potentially more) which minimizes the number of edges in the graph, without changing the reachability between the nodes of $G$. That is, if a path from $s$ to $t$ exists in $G$ a path from $s$ to $t$ must also exist...
Call such a set "universal transformer". Yes, there is a universal transformer. ------ Let $\mathcal{ALL}$ be the set of all Turing machines, that is, $\mathcal{ALL}=\{\langle M\rangle| M\text{ is a Turing machine}\}$, where $\langle\cdot\rangle$ is some fixed encoding scheme for Turing machines. By abuse o...
null
null
What is the best way of implementing the following function, $$f(x) = \frac{x}{\max(1, |x|)},$$ where $x$ is complex, using IEEE 754 floating point representations for the real and imaginary parts (i.e., `float` or `double`) such that $|f(x)| \leq 1$ for all possible values of $x$? The language doesn't matter,...
Best way to constrain a complex number to being within the unit circle?
|floating-point|numerical-algorithms|numerical-analysis|