instruction
stringlengths
0
29.8k
⌀
**Lemma 1**: If all $s$-$t$ simple paths go through some edge $(u, v)$ then all of them also go through the nodes $u$ and $v$. Conversely if all if all $s$-$t$ simple paths go through $u$ and $v$ and there is only one path between $u$ and $v$ then all the paths go through the edge $(u, v)$. Start BFS at $s$ and cons...
I am only familiar with binary implementations of information, though I am aware other implementations (ternary etc.) exist. I was wondering, if a code over $\mathbb{F}_q^n$ is used in practice, where $q\neq 2$, how is this done really? Do we use chunks of bits to encode elements of $\mathbb{F}_q$, for example $\{00, 0...
How are non-binary codes implemented in practice, i.e. codes over $\mathbb{F}_q^n$ for $q\neq q$?
|coding-theory|error-correcting-codes|
How are non-binary codes implemented in practice, i.e. codes over $\mathbb{F}_q^n$ for $q\neq 2$?
null
For $\mathbb{F}_2^n$ people store the bits consisting of the coefficients of the polynomial of some generator $x$. For $\mathbb{F}_q$ the field is isomorphic to simple integers mod $q$, so they simply store the integer in binary. I don't know of anything that actually uses $\mathbb{F}_q^n$ with $q > 2, n \geq 2$, but a...
null
null
null
is turing-machine framework only framework to analyse limits of computation?
null
Let $\Sigma_{1}=\{a,b\}$ and $\Sigma_{2}=\{t,f\}$. Define the function $f_{w}:\Sigma_{1}^{*}\rightarrow\Sigma_{2}^{*}$ for every $w\in\Sigma_{1}^{*}$; $f_{w}(w')\in\Sigma_{2}^{*}$ is the word obtained from $w'\in\Sigma_{1}^{*}$ by replacing the start position of each subword that matches $w$ with $t$ and any other p...
A problem maybe related to pattern-matching
|context-free|matching|substrings|pattern-recognition|string-matching|
Let $\Sigma_{1}=\{a,b\}$ and $\Sigma_{2}=\{t,f\}$. Define the function $f_{w}:\Sigma_{1}^{*}\rightarrow\Sigma_{2}^{*}$ for every $w\in\Sigma_{1}^{*}$; $f_{w}(w')\in\Sigma_{2}^{*}$ is the word obtained from $w'\in\Sigma_{1}^{*}$ by replacing the start position of each subword that matches $w$ with $t$ and any other p...
Let $\Sigma_{1}=\{a,b\}$ and $\Sigma_{2}=\{t,f\}$. Define the function $f_{w}:\Sigma_{1}^{*}\rightarrow\Sigma_{2}^{*}$ for every $w\in\Sigma_{1}^{*}$; $f_{w}(w')\in\Sigma_{2}^{*}$ is the word obtained from $w'\in\Sigma_{1}^{*}$ by replacing the start position of each subword that matches $w$ with $t$ and any other p...
In Theory of Computation lessons, the limits of computation are usually analyzed within the framework of Turing machines, so if something isn't solvable with Turing Machine, then we consider this problem as undecidable. I know computational models like Lambda Calculus are equivalent due to Turing-completeness, but ...
Is the Turing machine the only framework to analyse limits of computation?
The first two sentences of the document you linked says it all: > The *branch and bound method* is not a solution technique specifically limited to integer programming problems. It is a *solution approach* that can be applied to a number of different types of problems. In short, branch and bound, as utilized in s...
If $n$ is even, you can split the heap into two heaps of size $\dfrac{n}2$: For each binomial tree in the heap, remove its first child; reconstruct a heap with all the children you removed. Since a binomial heap has at most $\mathcal{O}(\log n)$ binomial trees, this operation is done in $\mathcal{O}(\log n)$. ...
null
Yes, both assumptions are true. Your pattern matching operation can be performed by a finite state automaton with output, a [finite state transducer][1]. Keep the last $|w|$ read symbols in memory, and output $t,f$ accordingly. (And at the end affix some $f$'s.) This closure property of the [regular][2] and conte...
One efficient algorithm to check if a directed graph is strongly connected is Kosaraju's algorithm. It runs in O(m) time complexity, where m is the number of edges in the graph. This algorithm involves two depth-first searches (DFS) and can determine if every vertex is reachable from every other vertex.
Given an undirected graph $G$ and two vertices $s$ and $t$, i want to find a minimal set of edges $E$ in $G$ such that every (simple) $s$-$t$-path contains at least 2 edges from $E$.\ Is this problem solvable in polynomial time? What if the paths should not contain 2, but $r$ edges in $E$? I know that for $r=1$, th...
null
Given an array of positive integers and a positive integer K, I need to find the minimum subset sum S greater than K, and the size of the smallest subset that sums to S. I have attempted to first find the minimum subset sum greater than K with a 0-1 knapsack approach, then finding the smallest subset that sums to th...
Algorithm for Minimum Subset Sum Greater Than K While Minimizing Subset Size
|algorithms|dynamic-programming|knapsack-problems|
null
Yes, both assumptions are true. Your pattern matching operation can be performed by a finite state automaton with output, a [finite state transducer][1]. Keep the last $|w|$ read symbols in memory, and output $t,f$ accordingly. (And at the end affix some $f$'s.) This closure property of the [regular][2] and conte...
null
Representing the polyhedron of feasible solutions as the intersection of half spaces, defined by linear inqualities, is known as H-representation. Representing that polyhedron by a list of its vertices (and its rays) is known as V-representation. So, your problem amounts to converting from H-representation to V-r...
null
I have many 3D boxes. All boxes are rectangular cuboids (they can rotate 90° so dimensions are interchangeable). The goal is to pack those boxes one into each other to minimize occupied space. There is no limit how deep boxes can be nested into each other. Single box can have multiple smaller boxes inside, and they can...
Nested boxes packing
|algorithms|
null
Answering the questions in the same order: 1. If the source of the signal is within current process, then it is synchronous because it is handled immediately and the OS sends interrupt to the process. Asynchronous is when external tool sends signal to process, for example using `kill` tool or [Ctrl+C](https://stacko...
If P = DTIME(n^c) and EXP = DTIME(2^n), and we prove that NP = EXP, then it means that NP = DTIME(2^n). According to the time hierarchy theorem, the set of languages decided in O(f(n)) is bigger than those decided in o(f(n)). So does that not imply P != NP?
If we prove that NP = EXP, does that automatically prove that P != NP?
|complexity-theory|time-complexity|
Yes, that is correct. It is currently considered unlikely that NP = EXP.
I need to implement a solution where I will have an image and other text variables as temperature, humidity and precipitacion. I wish to preview the inflow as output based on these inputs. I suspect that I'd need a CNN to classify the image and combine it with the other variables (precipitacion,temperature and humi...
Predict output using image and text variables as input
|artificial-intelligence|classification|
null
null
Are there langueges L1 ⊆ L2 ⊆ L3 when L1 and L3 are NP-Complete languages and L2 ∈ P? Would this imply P=NP? Thanks
Are there langueges L1 ⊆ L2 ⊆ L3 when L1 and L3 are NP-Complete languages and L2 ∈ P?
|p-vs-np|
Are there languages L1 ⊆ L2 ⊆ L3 where L1 and L3 are NP-Complete languages and L2 ∈ P? Would this imply P=NP? Thanks
Are there languages L1 ⊆ L2 ⊆ L3 when L1 and L3 are NP-Complete languages and L2 ∈ P?
That’s trivial. Take an NP-complete language L with three symbols a, b, and c. Let L’ be the same language with a, b, c replaced with d, e, f. Now pick L1 = L, L2 = (a|b|c)\*, and L3 = (a|b|c)* (epsilon | L’).
Consider the following problems: - $L_1$: - Input: two graphs $G_1$ and $G_2$ - Question: does $G_1$ contains an hamiltonian path and $G_2$ is complete? - $L_2$: - Input: two graphs $G_1$ and $G_2$ - Question: is $G_2$ complete? - $L_3$: - Input: two graphs $G_1$ and $G_2$ - Question: does $G...
null
Yes. We know that $\mathsf{P}\subseteq\mathsf{NP}\subseteq \mathsf{EXP}$. However, by diagonalization we know that $\mathsf{P} \neq \mathsf{EXP}$, hence one of the inclusions must be strict. So it follows that showing $\mathsf{NP}=\mathsf{EXP}$, implies $\mathsf{P}\neq \mathsf{NP}$.
Yes. Ladner's theorem shows that for any problem $X \in \mathrm{NP} \setminus \mathrm{P}$ there is a problem $Y \in \mathrm{NP} \setminus \mathrm{P}$ such that $Y$ is reducible to $X$ but not vice versa. If we apply the construction from Ladner's theorem to e.g. $\mathrm{SAT}$ we obtain a problem $Z \in \mathrm{N...
[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/8eSDf.png Can you provide the transition table along with the solution for better understanding?
How to convert the following from NFA with ε-moves to DFA?
|finite-automata|
How to put the given context-free grammar into Chomsky Normal Form?
In C it's well known to use simple routine for turning integer rng into float rng. Something like that ``` float frand( float min, float max ) { float scale = rand()/(float)RAND_MAX; // [0, 1.0] return min + scale * (max - min); // [min, max] } ``` So the core random number generation is happening inside...
Are float pseudo-random number generators always implemented using integer generators underneath
|floating-point|performance|pseudo-random-generators|c|random-number-generator|
Whether or not the set $D$ exists is equivalent to the fact that $G$ is bipartite. And, if G is bipartite, maximizing the set D means taking the bigger part in the bipartition in each connected component of $G$. Minimizing is the other way around. Testing whether G is bipartite and finding the parts can indeed be...
{"Voters":[{"Id":132305,"DisplayName":"Michal Dvořák"}],"DeleteType":1}
null
null
Given two unbounded knapsack instances, $K_1 = (W_1, weights, values), K_2 = (W_2, weights, values)$, where $W_1 \ne W_2$, what is the complexity of determining $v(K_1) = v(K_2)$ where $v$ returns the optimal sum of values given a knapsack instance? I know that the decision problem of knapsack -- i.e. asking whethe...
Complexity of determining two Knapsack instances that are the same but different initial weights have the same optimal value
|complexity-theory|np-hard|decision-problem|knapsack-problems|
null
Let's take a compound propositions Either it is below freezing or it is snowing. Now if $p$: it is below freezing $q$: it is snowing Will it be $p \vee q$ or $p \oplus q$? There are some instances where semantics are required. For example Either you are ill or appearing for exam. In this both cases c...
Does Either...Or means Exclusive Or or Inclusive Or?
|discrete-mathematics|propositional-logic|
Don't try to force formal definitions over common english language. "Either… or" means whatever you want it to mean. There is no convention. Just be precise when you want a formal definition. Also what is the problem with the answers given in the post you linked?
Let's take a compound propositions Either it is below freezing or it is snowing. Now if, <br> $p$: it is below freezing <br> $q$: it is snowing Question Link: https://gateoverflow.in/42720/kenneth-rosen-edition-6th-exercise-1-1-question-7-page-no-17 Will it be $p \vee q$ or $p \oplus q$? There are some ...
Probably you meant to *extract* the element. Also we are using a min-heap, so I would suppose you wanted to extract the smallest element, but the argument works for both. Suppose you can extract minimal element from a binary min-heap in time $o(\log n)$. I claim that you can sort in time $o(n\log n)$, which contradi...
Natural language is indeed ambiguous and depends a lot on semantics and specific context [[ref](https://math.stackexchange.com/a/2130413/993447)]. In English, Either/Or usually means Exclusive Or because we tend to use in the situation where two options are presented and exactly one should be True (let's say selecte...
I have no proof, but I expect it's probably hard, because given a target value $t$, it is easy to construct a knapsack problem $K_2$ whose optimal value is $t$. This means that your problem is at least as hard as testing, given $t$ and $K_1$ whether the optimal value of $K_1$ is equal to $t$. I don't know whether tha...
null
Natural language is indeed ambiguous and depends a lot on semantics and specific context [[ref](https://math.stackexchange.com/a/2130413/993447)]. In English, Either/Or usually means Exclusive Or because we tend to use in the situation where two options are presented and exactly one should be True (let's say selecte...
This answers the problem only partially (in particular, for the minimization) Whether or not the set $D$ exists is equivalent to the fact that $G$ is bipartite. This can be tested in polynomial time. Suppose that $G$ is conencted, otherwise do it per connected component. We know that if $G$ is connected then the b...
{"Voters":[{"Id":132305,"DisplayName":"Michal Dvořák"}]}
{"Voters":[{"Id":132305,"DisplayName":"Michal Dvořák"}],"DeleteType":1}
{"Voters":[{"Id":132305,"DisplayName":"Michal Dvořák"}]}
If you implement mergesort top-down you can always split the input of length $n$ into one of length $\lfloor n / 2\rfloor$ and one of length $\lceil n / 2 \rceil$. This ensures that all merges are always *well-balanced*: the left and right inputs differ in length by at most 1. Is there a way of achieving this proper...
Bottom-up well-balanced mergesort
|algorithms|sorting|recursion|
If you implement mergesort top-down you can always split the input of length $n$ into one of length $\lfloor n / 2\rfloor$ and one of length $\lceil n / 2 \rceil$. This ensures that all merges are always *well-balanced*: the left and right inputs differ in length by at most 1. Is there a way of achieving this proper...
Consider the following problems: - $L_1$: - Input: two graphs $G_1$ and $G_2$ - Question: does $G_1$ contain an hamiltonian path and is $G_2$ complete? - $L_2$: - Input: two graphs $G_1$ and $G_2$ - Question: is $G_2$ complete? - $L_3$: - Input: two graphs $G_1$ and $G_2$ - Question: does $G_...
If you implement mergesort top-down you can always split the input of length $n$ into one of length $\lfloor n / 2\rfloor$ and one of length $\lceil n / 2 \rceil$. This ensures that all merges are always *well-balanced*: the left and right inputs differ in length by at most 1. Is there a way of achieving this proper...
null
Determining whether two special variants of knapsack have the same optimal value
As a beginner in neural networks, I'm currently working on a project for predicting winning fighters in MMA matches. I understand that this is a complex task due to the nature of the sport. Currently, I'm achieving an accuracy of 64.2% on my test dataset. My goal is to increase this accuracy to 70%. The method I'...
Advice for better performance neural network
|machine-learning|neural-networks|data-sets|
I recently learned about the definition of PSPACE problems, which are a subset of decision problems that can be solved by using polynomial space. However, one thing I don't understand is when I asked my instructor whether any problem, as long as it uses polynomial space to solve, is in PSPACE, and the instructor said y...
Does every problems which can be solve by an algorithm using polynomial space is in PSPACE?