instruction stringlengths 0 29.8k ⌀ |
|---|
I'm practicing the following exercise for my exam: CFG {$w\in ${a,b,c}$^* | $#$_a(w) + $#$_b(w) = $#$_c(w)$} and I'm struggling a bit.
I've already solved {$a^nb^mc^l | n+m=l$} with production rules: $ S\rightarrow aSc | B|\varepsilon \\ B\rightarrow bBc|\varepsilon $,
which is almost the same except the posi... |
CFG {$w\in ${a,b,c}$^* | $#$_a(w) + $#$_b(w) = $#$_c(w)$} |
|context-free|formal-grammars| |
I'm practicing the following exercise for my exam: CFG {$w\in ${a,b,c}$^* | $#$_a(w) + $#$_b(w) = $#$_c(w)$} and I'm struggling a bit.
I've already solved {$a^nb^mc^l | n+m=l$} with production rules: $ S\rightarrow aSc | B|\varepsilon \\ B\rightarrow bBc|\varepsilon $,
which is almost the same except the posi... |
I'm practicing the following exercise for my exam: CFG {$w\in ${a,b,c}$^* | $#$_a(w) + $#$_b(w) = $#$_c(w)$} and I'm struggling a bit.
I've already solved {$a^nb^mc^l | n+m=l$} with production rules: $ S\rightarrow aSc | B|\varepsilon \\ B\rightarrow bBc|\varepsilon $,
which is almost the same except the posi... |
I'm practicing the following exercise for my exam: CFG {$w\in ${a,b,c}$^* | $#$_a(w) + $#$_b(w) = $#$_c(w)$} and I'm struggling a bit.
I've already solved {$a^nb^mc^l | n+m=l$} with production rules: $ S\rightarrow aSc | B|\varepsilon \\ B\rightarrow bBc|\varepsilon $,
which is almost the same except the posi... |
See the following discussions in other stack exchange groups.
See discussion in https://stackoverflow.com/questions/23592131/what-is-the-difference-between-subtyping-and-inheritance-in-oo-programming
Also see https://cstheory.stackexchange.com/questions/10620/how-does-inheritance-differ-from-subtyping
However... |
null |
Determine two languages L and L1 on the alphabet {a,b} with regular L, L∩L1 is non-regular and L1 does not contain L.
I came up with this solution:
L = { w | w ends with the string aba}
L1 = {w | w = w^r (palindrome) }
**L∩L1 = {w | w ends with the string aba AND w is palindrome}**
I don't know if this is c... |
Intersection of a regular and a non-regular language can give a non-regular language? |
|regular-languages|finite-automata| |
It’s very easy really.
Take any non-regular language L, and then the regular language of all strings (a | b)*. The intersection is L. |
I am puzzled by a point in [this paper][1] by Phil Wadler.
> Figure 6 shows a proof of the law of the excluded middle, A ∨ ¬A. The computational interpretation of this proof exploits the ability of classisal [sic] control operators to return multiple times from a single term. The term of type A ∨ ¬A first returns a... |
What is "the ability of classical control operators to return multiple times from a single term"? |
|logic|curry-howard| |
null |
null |
It’s very easy really.
Take any non-regular language L1, and then the regular language of all strings (a | b)*. The intersection is L1. |
I have been trying to understand the following proof but so far no cigars.
**My Understanding:**\
For a given function $f$ we can define $C_{1}(f)$ as a $k$-DNF formula where $k$ represents the size of the certificate and where every clause in the formula is a different certificate. Similarly we can define $C_{0}... |
Prove that $Decision Tree Complexity$ $\leq$ $(Certificate Complexity)^{2}$ |
|complexity-theory| |
We are looking into a 2D sampling of points for our robot's map. By sampling, I mean taking an initial point in our map and growing the tree structure through the 2D space by adding more points with a minimum radius approach. We need a graph or tree data structure with the following requirements:
1. Sampling and ad... |
How do I calculate the complexity of this Algorithm below? I would like to know how I calculate the sums that form to obtain a formula as a function of n? I know that in general this algorithm has O(n^3) complexity, but how can I do that?
int i,j,k,s;
for(i=0; i < N-1; i++)
for(j=i+1; j... |
Given a binary $n \times n$ matrix, we would like to decide whether there is a row or a column which consists entirely of $1$s. The caveat is that after we read an entry of the matrix, it is erased. How much space do we need in order to solve this task?
If entries do not get erased, the task can be solved in space $... |
It’s very easy really.
Take any non-regular language L1, and then the regular language of all strings (a | b)*. The intersection is L1.
If you want neither language to be a subset of the other, take a short string S in the non-regular language and use the regular language “all strings other than S”. |
I have been trying to understand the following proof but so far no cigars.
**My Understanding:**\
For a given function $f$ we can define $C_{1}(f)$ as a $k$-DNF formula where $k$ represents the size of the certificate and where every clause in the formula is a different certificate. Similarly we can define $C_{0}... |
I'm working on a problem from my textbook (not homework, just an example), and it asks us to calculate the 'best case' scenario of reading a 1MB file from the hard drive.
I don't know why the right way to calculate the total time involves the max time for a single rotation. Also in the answer they said that a 1MB f... |
I'm working on a problem from my textbook (not homework, just an example), and it asks us to calculate the 'best case' scenario of reading a 1MB file from the hard drive.
I don't know why the right way to calculate the total time involves the max time for a single rotation. Also in the answer they said that a 1MB f... |
null |
I'm working on a problem from my textbook (not homework, just an example), and it asks us to calculate the 'best case' scenario of reading a 1MB file from the hard drive.
I don't know why the right way to calculate the total time involves the max time for a single rotation. Also in the answer they said that a 1MB f... |
I think if you use [my preprocessing](https://cs.stackexchange.com/a/164474/157538) before [Jojo's line algo](https://cs.stackexchange.com/a/164501/157538), it will work for $i \ne j$
Jojo's algo assumes you need both $ij$ and $ji$ to find the optimum, but my prunning defines exactly which Point should be the first ... |
I think if you use [my preprocessing](https://cs.stackexchange.com/a/164474/157538) before [Jojo's line algo](https://cs.stackexchange.com/a/164501/157538), it will work for $i \ne j$
Jojo's algo assumes you need both $ij$ and $ji$ to find the optimum, but my prunning defines exactly which Point should be the first ... |
null |
null |
You are interested in the language $L = \{w\in \{a,b,c\}^∗\mid
\#_a(w)+
\#_b(w)=
\#_c(w) \}$ but question how to haave the symbols in arbitrary order.
You have solved $\{w\in \{a,b\}^∗\mid
\#_a(w)=
2\#_b(w)\}$ where the position does not matter.
I suggest you write a grammar for the simpler language $\{... |
I think it is possible to solve this problem in $\mathcal O(n \log n)$. Note that this is an improvement to this answer, which previously did not handle that $i \ne j$. See below for how this is added.
First, observe that the $\max\{a_i b_j, a_j b_i\}$ is unnecessary: It can be replaced by $a_i b_j$, since we get th... |
I think if you use [my preprocessing](https://cs.stackexchange.com/a/164474/157538) before [Jojo's line algo](https://cs.stackexchange.com/a/164501/157538), it will work for $i \ne j$
Jojo's algo assumes you need both $ij$ and $ji$ to find the optimum, but my prunning defines exactly which Point should be the first ... |
We aim to optimize the execution of a specific task.
Consider a set, **P**, containing **N** 2D points. A new query point, **p1**, is introduced, and the objective is to identify the nearest point in **P** to **p1**. If the distance surpasses a specified threshold, **p1** is incorporated into **P**, increasing its c... |
Optimal graph data structure for set of points that allows dynamic updates |
|graphs|data-structures|trees|c++| |
null |
A minimal unsatisfiable partial assignment for 3-CNF is a partial assignment that:
1. There exists a clause where all variables are unsatisfied.
2. Unfixing any variable makes every clause contain at least one free variable.
Particularly for 2-SAT and 3-SAT is their number bounded by polynomial?
If yes, then ... |
null |
I think it is possible to solve this problem in $\mathcal O(n \log n)$. Note that this is an improvement to this answer, which previously did not handle that $i \ne j$. See below for how this is added. Also note that what described below is a version of the [Convex Hull Trick][1].
First, observe that the $\max\{a_i ... |
The control operators in question allow you to capture continuations such that calling the continuation is in some sense equivalent to "returning from" the expression. so, for instance, in (using Haskell syntax):
callCC (\k -> ...)
There are two ways for the expression to "return" to its context:
1. The `.... |
I've done some PL-related work in Rust that requires some proofs to guarantee the resulting language is free of data races. I'd like to include such work in a paper, but I'm not sure whether I should just formulate the work using operational semantics or whether that approach is becoming outdated, and tools like CoQ ar... |
Formal Proofs for Rust-related Programming Languages Paper |
|programming-languages|rust| |
null |
You are looking for a data structure for [nearest neighbor search](https://en.wikipedia.org/wiki/Nearest_neighbor_search) that supports dynamic updates. I suggest reviewing Wikipedia, as it has a good overview of many different data structures.
Inserting an element into a k-d tree does not require rebuilding the en... |
|graphs|data-structures|trees|nearest-neighbour|dynamic-algorithms| |
null |
null |
I am puzzled by a point in [this paper][1] by Phil Wadler.
> Figure 6 shows a proof of the law of the excluded middle, $A ∨ ¬A$. The computational interpretation of this proof exploits the ability of classisal [sic] control operators to return multiple times from a single term. The term of type $A ∨ ¬A$ first retur... |
null |
Binary search is the well-known algorithm that compares the input value to an entry in a sorted array, and based on the result then decides to check the same input value against another entry either on the left or the right of that array entry. The number of comparisons needed is O(log(n)), but we can specify the numbe... |
"Unbounded" binary search in $\log_2(n) + O(?)$ comparisons |
|algorithms|time-complexity|binary-search| |
I don't know the name of this algorithm, but anyway it was interesting to share (btw Linear sieve, Sieve of Atkin and Sieve of Pritchard performs better)
func PrimesUpTo(n int) []bool {
isPrime := make([]bool, n+1)
for i := 2; i <= n; i++ {
isPrime[i] = true
}
primes := make([]int,... |
O(n) algorithm to find primes up to n |
|algorithms|discrete-mathematics|primes| |
I don't know the name of this algorithm, but anyway it was interesting to share (btw Linear sieve, Sieve of Atkin and Sieve of Pritchard performs better)
The main idea is to use the Fundamental theorem of arithmetic, and iterate through primes and at each prime cancel out every possible number expressed as a product... |
Take an out-of-order processor. At any cycle, there may be multiple instructions ready for execution. The choice which to execute next can affect the total execution time in unpredictable (for the processor) ways.
Register forwarding can lead to a different instruction being executed next, with a different total ex... |
Binary search is the well-known algorithm that compares the input value to an entry in a sorted array, and based on the result then decides to check the same input value against another entry either on the left or the right of that array entry. The number of comparisons needed is O(log(n)), but we can specify the numbe... |
null |
In the context of finite, simple, undirected graphs, associate with each node $v\in V$ an integer $n(v)$ (you can limit this to positive integers without loss of generality). Create the set of edges by defining a threshold $T$, and join an edge $x,y$ iff $n(x)+n(y) \geq T$. These are called *threshold graphs*$^{[1]}$ a... |
Name of graph family defined by modular sum |
|graphs|reference-request|modular-arithmetic| |
I have a dataflow graph where a set of different types of tasks are placed in corresponding types of nodes.
Say the task types are called A, B, and C.
- A-type tasks are placed in all the leaf nodes of the dataflow graph.
- B-type tasks are placed in nodes with the data from any two nodes hosting A-type tasks, or ... |
null |
I have a dataflow graph where a set of different types of tasks are placed in corresponding types of nodes.
Say the task types are called A, B, and C.
- A-type tasks are placed in all the leaf nodes of the dataflow graph.
- B-type tasks are placed in nodes with the data from any two nodes hosting A-type tasks, or ... |
Your question was completely solved by Bentley and Yao, [An almost optimal algorithm for unbounded sorting](https://www.slac.stanford.edu/cgi-bin/getdoc/slac-pub-1679.pdf), and Beigel, [Unbounded searching algorithms](https://cis.temple.edu/~beigel/papers/unbounded-search-sicomp.PS.gz). They showed that if $f\colon \ma... |
Here is the proof in more detail. We are given a function $f\colon \{0,1\}^n \to \{0,1\}$, and want to design a decision tree for $f$ of depth at most $C_0(f) C_1(f)$. This corresponds to an algorithm which makes at most $C_0(f) C_1(f)$ many queries to the inputs of $f$ and finds out the value of $f$.
The algorithm ... |
I'm studying for final and currently stuck in the question below.
You have an embedded processor. It has its L1 instruction and data cache.
No L2 or last level cache are available. Consider the following assumptions.
The processor core is running at 2 GHz.
- Memory access instructions are 25 % of total instructi... |
How to calculate memory bandwidth? |
|cpu-cache|cache| |
Bazzi, Fiorini, Pokutta, and Svensson showed in their paper [No small linear program approximates Vertex Cover within a factor $2-\varepsilon$](https://arxiv.org/pdf/1503.00753.pdf) that every polynomial size LP relaxation of Vertex Cover has integrality gap $2-\varepsilon$, meaning (essentially) that any one-step roun... |
Two sorted arrays `A` and `B` are given having size `l` and `m` respectively. Our task is to find the median of these two sorted arrays combined. Suppose the length of the combined array is `n` i.e. `n = l + m`.By definition the median will be greater than half of the elements and less than the other half.
Suppose... |
Median of two sorted arrays |
|algorithms|divide-and-conquer|binary-search| |
## Research on Photorealistic 3D Virtual Environments for Robotics
### Background
I am engaged in a **robotics research project** focusing on the development and evaluation of **photorealistic 3D virtual environments**. Our approach integrates **Neural Radiance Fields (NeRF)** with **Unreal Engine 5 (UE5)** to cr... |
What Quantitative Evaluation Methods Should Be Used for Robotics Simulation Research? |
|simulation|robotics| |
I am studying the cycle cancelling algorithm for the minimum cost flow problem, and I can not understand the proof of the following:
If there no negative cost cycles then you have a minimum cost flow. The other direction is easy but I am stuck with this one.
If you want to get a smaller cost with an augmentation ... |
cycle-cancelling algorithm, minimum cost flow |
|network-flow| |
Cycle-cancelling algorithm, Minimum cost flow |
I am studying the cycle cancelling algorithm for the minimum cost flow problem, and I can not understand the proof of the following:
If there no negative cost cycles then you have a minimum cost flow. The other direction is easy but I am stuck with this one.
If you want to get a smaller cost with an augmentation ... |
I've been reading on the Tree-vs-Aversary game in the example of proving the lower bound of a Decision Tree in the context of Resolution Refutation Proof Complexity.
While I understand how the Adversary game can be used in proving the lower bound of the depth of the tree, I have problems visualising the Tree-vs-Adver... |
An easy explanation of Tree-vs-Aversary Game |
|complexity-theory| |
Your graph class is the class of graphs that are a disjoint union of a clique and a bunch of bicliques, possibly singletons.
We can safely assume that the labels $\ell(v) \in [0,T)$, and it is then clear that every pair of vertices with the same label is going to be a twin.
They will be true twins if and only i... |
$\mathrm{MFVS} \leq 1$ is a concise way of writing the following decision problem:
> Let $G = (V, E)$ be a directed graph. Is there a $v \in V$ such that every cycle in $G$ passes through $v$?
(More generally, $\mathrm{MFVS}$ stands for _minimal feedback vertex set_, the problem of finding the smallest set of ver... |
null |
I don't know the name of this algorithm, but anyway it was interesting to share (btw Linear sieve, Sieve of Atkin and Sieve of Pritchard performs better)
The main idea is to use the Fundamental theorem of arithmetic, and iterate through primes and at each prime cancel out every possible number expressed as a product... |
null |
I am currently trying to relate grammars to graphs in the context of syntax and graph based testing. Especially how would I map non-terminals and terminals to nodes and edges in relation to the following quote:
> ... [Terminal Symbol Coverage] and [Production Derivation Coverage]* can be rewritten to be equivalent t... |
Mapping a grammar to a graph - Relation of Terminal Symbol and Node Coverage in Software Testing |
|graphs|formal-grammars|software-testing|testing| |
Suppose a problem:
> Given $n$ pigeons and $m$ holes of sizes $b_{i\le m}$ decide if you can put all pigeons in given holes.
It's possible to find a refutation of size $\mathcal O(n^2\log^2 n)$ of this principle when it's encoded as a conjunction of threshold functions, therefore there must exist a polynomial siz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.