instruction stringlengths 0 29.8k β |
|---|
|context-free|formal-grammars| |
null |
Actually, like some have said, CS teaches theories mainly and as a programmer with computer science background, itβll help you think and write better structured algorithms. |
Suppose we have an approximation algorithm to some maximization problem, that returns a solution with value $(1-\epsilon)*OPT$.
* If the runtime of the algorithm is polynomial in the input size and $1/\epsilon$, then it is called an FPTAS.
* If the runtime is polynomial in the input size and $\log(1/\epsilon)$, th... |
Approximation algorithm with runtime complexity between poly(log(1/eps)) and poly(1/eps)? |
null |
The halting problem doesn't really tell you anything about whether you can prove that a TM recognises a given language.
We can prove that the TM recognises $\{0^n1^m : n \geq 1\}$ using the definition of $L(M)$ and $\mapsto_M$.
One thing to note is that the machine is *deterministic*, so for each state and characte... |
null |
The halting problem doesn't really tell you anything about whether you can prove that a TM recognises a given language.
We can prove that the TM recognises $\{0^n1^m : n \geq 1\}$ using the definition of $L(M)$ and $\mapsto_M$.
One thing to note is that the machine is *deterministic*, so for each state and characte... |
null |
|algorithms|finite-automata|formal-grammars|machine-learning| |
I'm working on constructing deterministic finite automata (DFAs) with a specific learning complexity when using the L* algorithm developed by Dana Angluin. My goal is to create a DFA of size \( n \) that necessitates \( n-1 \) equivalence queries for the L* algorithm to correctly learn the automaton.
The L* algorith... |
null |
I've been trying to get a deeper understanding of how dynamic programming works and came across how it can be represented as directed acyclic graphs (DAGs). It's easy to see why, nodes represent the subproblems and directed edges represent which problem the subproblems help solve. Similar to a recursion tree but with r... |
Dynamic Programming as DAGs - Solution Always Shortest Path? |
|algorithms|dynamic-programming|shortest-path|dag| |
null |
I attempted this question and I do not understand why the last option is necessary in order to get the right answer.
My logic/thought-process:
In this question, only two scenarios can occur:
Scenario 1: Data was sent from the receiver but was corrupted. The Data is sent again and it is not corrupt this time.
... |
Networking - RDT 2.0 - How can this FSM transition occur? |
|computer-networks| |
I attempted this question and I do not understand why the last option is necessary in order to get the right answer.
My logic/thought-process:
In this question, only two scenarios can occur:
**Scenario 1:** Data was sent from the receiver but was corrupted. The Data is sent again and it is not corrupt this tim... |
Dynamic programming can often be expressed as a shortest path problem on a DAG, but not always. It depends on the recurrence relation. If the recurrence relation has the form
$$A[j] = \min \{A[i] + f(i,j) | i < j\}$$
then it can be expressed as a shortest-path problem on a DAG (with each edge $(i,j)$ having len... |
One of my undergraduate math professors used to say "we'll always be drawing a picture, even when it is impossible", and I came to strongly sympathize with his witty point. Some recursion theory proof techniques are rather easy to visualize: diagonalization argument is easily pictured as filling out a table, and subse... |
Wrapping one's head around priority arguments |
|proof-techniques| |
I'm creating a plagiarism detection algorithm in Python, which scores how much of document A has been plagiarised in document B, and returns all the copied sections in B that were plagiarised from A.
Here's my working version:
```python
from textdistance import LCSStr
DEFAULT_MIN_SUBSTRING_LEN = 30
def g... |
One of my undergraduate math professors used to say "we'll always be drawing a picture, even when it is impossible", and I came to strongly sympathize with his witty point. Some recursion theory proof techniques are rather easy to visualize: diagonalization argument is easily pictured as filling out a table, and subse... |
null |
closest I could find so far:
https://arxiv.org/abs/2002.08498 provides an SC algoritgm (polylog space, poly time) for approximation of LIS
savitch seems to give smallest space so far |
Recently, when I self-learnt Discrete Mathematics and Its Applications 8th by Kenneth Rosen, I did only the even-numbered exercises which the author offers the detailed description instead of the odd ones because the odd ones and the corresponding even ones are very similar.
I have asked one similar question QA_1 ["... |
The formal proof that one Turing Machine computes one specific function |
|formal-languages|turing-machines|proof-techniques| |
Recently, when I self-learnt Discrete Mathematics and Its Applications 8th by Kenneth Rosen, I did only the even-numbered exercises which the author offers the detailed description instead of the odd ones because the odd ones and the corresponding even ones are very similar.
I have asked one similar question QA_1 ["... |
Recently, when I self-learnt Discrete Mathematics and Its Applications 8th by Kenneth Rosen, I did only the even-numbered exercises which the author offers the detailed description instead of the odd ones because the odd ones and the corresponding even ones are very similar.
I have asked one similar question QA_1 ["... |
Here is a picture for you: Your requirements are ordered as $0,1,2,\ldots$; each requirement equipped with a lamp that can be grey, green or red. Initially, all requirements are grey, as they are not active yet. If a requirement becomes active, the light turns red. Your construction provides a way to handle each indivi... |
Recently, when I self-learnt Discrete Mathematics and Its Applications 8th by Kenneth Rosen, I did only the even-numbered exercises which the author offers the detailed description instead of the odd ones because the odd ones and the corresponding even ones are very similar.
I have asked one similar question QA_1 ["... |
null |
I want to construct a **regular expression for strings over the alphabet {a, b, c} that donβt contain the contiguous substring "baa"**. I tried to follow the same procedure as in [all the words that don't have both substring bba and abb][1], where the goal was to find a regular expression that matches **all words that ... |
Construct a regular expression for strings over the alphabet {a, b, c} that donβt contain the contiguous substring "baa" |
|finite-automata|regular-expressions| |
The formal proof that one Turing Machine computes one specific function $f(n_1,n_2)=\max(n_1,n_2)$ |
I find it easier to build a DFA directly in this case.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/c3Q84.png |
I have asked one similar question QA_1 ["The formal proof that one Turing Machine recognizes one specific *language*"][1] and the answer fills the part "It does not generate any string that is *not* in $L$." of [this QA_2 answer][2].
---
For one *general* function, the Halting Problem tells us it is [impossible][... |
I have asked one similar question QA_1 ["The formal proof that one Turing Machine recognizes one specific *language*"][1] and the answer fills the part "It does not generate any string that is *not* in $L$." of [this QA_2 answer][2].
---
For one *general* function, the Halting Problem tells us it is [impossible][... |
null |
So, Usually in Theory of Computation lessons, limit of computation is analysed within the framework of Turing machines, so if something isn't solvable with Turing Machine, then we consider this problem as undecidable. I know about equivalent computational models like Lambda Calculus and all of those turing-completeness... |
is turing-machine framework only framework tu analyse limits of computation? |
|turing-machines|undecidability|turing-completeness|decidability|philosophy| |
I have asked one similar question QA_1 ["The formal proof that one Turing Machine recognizes one specific *language*"][1] and the answer fills the part "It does not generate any string that is *not* in $L$." of [this QA_2 answer][2].
---
For one *general* function, the Halting Problem tells us it is [impossible][... |
I have asked one similar question QA_1 "The formal proof that one Turing Machine recognizes one specific *language*" and [the answer][1] fills the part "It does not generate any string that is *not* in $L$." of [this QA_2 answer][2].
---
For one *general* function, the Halting Problem tells us it is [impossible][... |
null |
null |
I'm trying to prove a statement "given a graph G=(V,T) and that no cycle C exists that contains only edge "e" and other edges that their weight is smaller than that of "e", prove that "e" must be in some mst".
I tried to proof by contradiction, but I'm not sure what I can say about "e" when it never belongs to any mst... |
If an edge e doesn't belong to any mst, then what can we say about e? |
|minimum-spanning-tree|proof-assistants| |
|minimum-spanning-tree| |
null |
Turing machines are far from being the only model of computation considered by computer scientists. Among well-studied models of computation are:
- Turing machines,
- Ξ»-calculus (and its many variants, typed or not),
- [General recursive functions](https://en.wikipedia.org/wiki/General_recursive_function) (sometim... |
I'm not an expert, but can give at least a partial answer since I've been reading about this lately. The more recent preprint [A Logical Approach to Type Soundness](https://iris-project.org/pdfs/2024-submitted-logical-type-soundness.pdf) gives a good overview of what this is all about, outside the specific context of R... |
Suppose that you run Kruskal's algorithm, which computes an MST by repeatedly adding the cheapest edge that does not create a cycle.
In any run of Kruskal, when we consider your edge $e = uv$, it turns out that $u$ and $v$ are already in the same connected component.
That means that there is a path from $u$ to $v... |
null |
The running time of the algorithm is linear in terms of $n$, but yes, you're right the algorithm does have a pseudo-polynomial time complexity since the standard is for the running time to be in terms of the number of bits of the input.
The articles don't make this distinction since this they're written for beginner... |
Yes, the first paragraph is also talking about virtual memory concepts. It describes how to translate virtual addresses (used by programs) into physical addresses in the main memory. The page table holds the mappings between virtual pages and physical page frames. When a program references a virtual address, the page t... |
Let $G=(V,E)$ be an undirected connected graph with a set of vertices $|V|$ and a set of edges $|E|$. A set cover $D$ satisfies $D \subseteq V$ and $uv \in E \implies u \in D \lor v \in D$. A variant of the vertex cover requires that **exactly one vertex**, $u$ or $v$, not both, is in $D$. In this sense, no vertices in... |
No Neighbor Vertex Cover |
|complexity-theory|optimization|dynamic-programming|np-hard| |
|complexity-theory|graphs|optimization|dynamic-programming|np-hard| |
Here's my stab at it. I'm not certain that this is correct, so take it with a grain of salt.
**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 b... |
null |
I have asked one similar question QA_1 "The formal proof that one Turing Machine recognizes one specific *language*" and [the answer][1] fills the part "It does not generate any string that is *not* in $L$." of [this QA_2 answer][2].
---
For one *general* function, the Halting Problem tells us it is [impossible][... |
I have asked one similar question QA_1 "The formal proof that one Turing Machine recognizes one specific *language*" and [the answer][1] fills the part "It does not generate any string that is *not* in $L$." of [this QA_2 answer][2].
---
For one *general* function, the Halting Problem tells us it is [impossible][... |
The formal proof that one Turing Machine computes one specific function |
I'm trying to prove that the algorithm for subset sum, that is the algorithm that given a set of numbers $\\{x_1, \dots, x_n\\}$ and a number $K$ find if there is a subset $\\{x_{1_k}, \dots, x_{n_k}\\}$ that adds up to $K$.
Now one of the typical backtracking algorithm is of the form (I know there are better ways ... |
Subset sum backtracking algorithm correctness proof |
|correctness-proof|backtracking| |
Consider the related problems of, given a strongly normalizing lambda term, computing the longest and shortest paths ending in a normal form.
In terms of bits of input the optimal complexity is some uncomputable function (since the input can be a Busy Beaver etc.). But the complexity of brute force is still quite la... |
Are there non-brute-force algorithms for longest or shortest beta reduction path? |
|complexity-theory|lambda-calculus| |
In the context of linear integer programming, we have a branch and bound algorithm described [here](http://web.tecnico.ulisboa.pt/mcasquilho/compute/_linpro/TaylorB_module_c.pdf). This involves solving the non-integer constrained linear program and successively introducing additional constraints, thus getting a bunch o... |
Regular branch and bound vs integer programming branch and bound |
|optimization|combinatorics|integer-programming| |
null |
I ran into this question that says with a given binomial heap with n elements and n is divisible by 8 split the heap into 2 binomial heaps, a one with 3n/8 elements and the other with 5n/8 elements, so I tried using another heap as a helping heap that saves the heaps I need to merge, but I didn't exactly know how to sp... |
Splitting a binomial heap into 3n/8 and 5n/8 binomial heap whereas 8 divides n with O(log(n)) time |
|algorithms|data-structures|heaps| |
null |
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)$ children, this operation is done in $\mathcal{O}(\log n)$.
Using ... |
The reference blog has changed and it seems to have been corrected which includes the OP's correction. Although the waybackmachine archived this blog old uncorrected version ([2013 version][1]) but it can't render the formula images.
The [corrected reference blog](https://web.archive.org/web/20231202213618/https://j... |
null |
The reference blog has changed and it seems to have been corrected which includes the OP's correction. Although the waybackmachine archived this blog old uncorrected version ([2013 version][1]) but it can't render the formula images.
The [corrected reference blog](https://web.archive.org/web/20231202213618/https://j... |
null |
null |
The runtime of $0/1$ knapsack problem using dynamic programming is $O(nW)$. Now assume that $W = 2^n$, then the runtime of the above algorithm is $O(n2^n)$, which is not a polynomial runtime in $n$. The runtime of the algorithm depends upon $n$ and $W$. If your input is represented in the binary then $W$ takes constan... |
null |
I am quite new to Regular Expressions, and I'm trying to solve this problem:
> Design a regular expression that accepts the language of all binary strings which their length is odd with no occurrences of 11.
At first, this is what I have:
`(0(00) * 1 + 1(00) * 0) * (0 + 1)`
However, I am told that this is wro... |
RegEx of odd length binary strings with no '11' |
|regular-expressions| |
Your answer is correct, since your algorithm indeed runs in time $\binom{r}{k}n$.
Let us go the extra mile and take a moment to think about the worst case input to your algorithm, and see if we can manage to write the running time as $f(r)n$ or $f(p)n$, to show that the algorithm is FPT. Of course, this is not neces... |
null |
null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.