instruction
stringlengths
0
29.8k
⌀
null
There is an obvious difference: you are an inhabitant (member) of humankind, but since you are not a collection of little humans you are not a subset of humanity. And as Bertrand Russell taught us all, one should *not* conflate an object $x$ with the singleton set $\{x\}$. The relevant analogy is $$\frac{\text{elem...
null
null
I am trying to learn about formal languages and I was wondering how I would go about defining the language that contains all strings which have matched parentheses and this is the definition I came up with — $L = \{(x*)|x\in L\}\cup\{\epsilon\}$ Here, $($ and $)$ denote the literal characters '(' and ')' respecti...
Have I correctly defined the language of strings that have balanced parenthesis?
|formal-languages|
{"Voters":[{"Id":160428,"DisplayName":"ZarakshR"}],"DeleteType":1}
{"Voters":[{"Id":160428,"DisplayName":"ZarakshR"}]}
I'm looking for a directed graph data structure where each node is unique and contains a set of elements (at least one). Each node must contain all elements from nodes pointing to it so it possible to walk from each root node and visit all supersets. [![enter image description here][1]][1] I actually only need i...
Directed graph where each node must contain all elements from source nodes
|graphs|graph-traversal|
null
I've been stuck with this problem for quite a while now, and after reading so many papers I'm unsure whether this is even possible. The problem is quite simple: Given $G = (V, E)$ an undirected graph, find the minimum number of vertices such that their removal from $G$ leaves us with a graph of maximum diameter ...
Constant factor approximation algorithm for Vertex Deletion version of Maximum Diameter Bounded Subgraph
|algorithms|graphs|approximation|clique|
I've been working on Quantum Circuits for a 1.5 months. And firstly i've created Full Adder in Quantum Circuit. And first times i was creating Full Adder with too Qubits. But last week i created another circuit like that: [![enter image description here][1]][1] And code here: def LessQubitAdder(X, Y): ...
Quantum Full Adder
|circuits|quantum-computing|
null
My goal is to find the local minimums of a smooth multivariate function $f_t(\vec y)$ for multiple values of $t$. I have created an algorithm $foo(t,\vec x)$ which returns the results of Newton's Method (by "results", I mean that $foo(t,\vec x)$ returns $\vec a$, where $\vec a$ is a local minimum for $f_t(\vec y)$) on ...
Best method to run an optimizing function millions of times
|algorithms|optimization|computer-architecture|
null
Given this shell sort algorithm implementation: ``` void shell(float ∗a ,int l ,int r) { int i, j, h; for ( h = 1 ; 3∗h +1 <= r−l; h = 3∗h + 1 ); for (; h > 0; h / = 3) { for (i = l+h; i <= r; ++ i) { for (j = i; j >= l +h && a[j] < a[j−h]; j −= h) { swap (a+j−h , a+ j ); } ...
Shell algorithm knuth sequence time complexity analysis
|algorithm-analysis|asymptotics|
|algorithm-analysis|asymptotics|sorting|
|algorithm-analysis|asymptotics|sorting|c|
null
I am trying to find a textbook reference for an algorithm that gives you a relative estimate of a quantity $a$ (i.e. $|a-\overline{a}|\leq \epsilon_{rel} a$) from an algorithm that gives you an estimate with relative error $|a-\overline{a}| \leq \epsilon_{abs}$ for $a \in (0,1]$. The algorithm that I can think of (w...
Algorithm for finding relative estimate from absolute estimate
|algorithms|algorithm-analysis|randomized-algorithms|error-estimation|
Referencing $L$ in the definition of $L$ is not meaningful, because it makes the definition self-referential/circular, which isn't kosher. You can't define a concept in terms of the concept. While there are structured ways to address the challenges associated with self-reference in definitions (e.g., recursively defi...
null
I have a medical dataset, which is something like this ```csv | Disease | Symptoms | | -------- | -------- | | Disease 1 | ['Symptom1', 'Symptom2', 'Symptom3', ...] | | Disease 2 | ['Symptom2', 'Symptom11', 'Symptom7', ...] | | Disease 3 | ['Symptom55', 'Symptom91', 'Symptom65', ...] | ``` I wan...
ML model to pick to classify data with inputs as an array of strings?
|machine-learning|natural-language-processing|
null
{"Voters":[{"Id":-1,"DisplayName":"Community"}]}
null
I want to implement an AI capable of playing the game RoboRally (https://en.wikipedia.org/wiki/RoboRally) using Monte Carlo Tree Search (MCTS). In RoboRally, there are 2-8 characters controlled by (human) players, each of which must reach checkpoints. However, each turn, a character can only move by playing cards chose...
Monte Carlo Tree Search for Robo Rally AI
|artificial-intelligence|search-trees|board-games|monte-carlo|
null
null
Given a ternary string S of length N, do the following: - Find the first strictly decreasing pair of digits. - Randomly change one of the digits in the pair to another value. - The string is circular (i.e the digit after the last digit is the first digit) - The program terminates when there is no strictly decreasin...
Random process on ternary string
|time-complexity|proof-techniques|randomized-algorithms|termination|
We need to partition a graph into subgraphs of size at most k each, such that every vertex is connected to at least one other vertex in its subgraph. In other words, we want to partition the graph into connected subgraphs of size between 2 to k. When k=2, the problem is equivalent to the [perfect matching problem]...
We need to partition a graph into subgraphs of size at most k each, such that every vertex is connected to at least one other vertex in its subgraph. In other words, we want to partition the graph into connected subgraphs of size between 2 to k. When k=2, the problem is equivalent to the [perfect matching problem]...
We need to partition a graph into subgraphs of 3 vertices each, such that every subgraph has at least 2 edges. The problem is similar to the [partition into triangles problem][1] (which is NP-complete) but not the same because each subgraphs may contain 2 or 3 edges (unlike the triangles problem, which requires 3 ed...
Partition a graph into connected subgraphs of 3 vertices each
|graphs|partitions|
Given a ternary string S of length N, do the following: - Find the first strictly decreasing pair of digits. - Randomly change one of the digits in the pair to another value. - The string is circular (i.e the digit after the last digit is the first digit) - The program terminates when there is no strictly decreasin...
Given a ternary string S of length N, do the following: - Find the first strictly decreasing pair of digits. - Randomly change one of the digits in the pair to another value. - The string is circular (i.e the digit after the last digit is the first digit) - The program terminates when there is no strictly decreasin...
How to go about analysing the I/O complexity when there are multiple levels of memory involved? Looking up I/O complexity analyses returns papers such as [this one][1], which generally assume for simplicity that the memory is just two-level (disk and cache). [1]: https://dl.acm.org/doi/10.1145/48529.48535
I/O Complexity Analysis with Memory Hierarchies
|algorithms|optimization|computer-architecture|runtime-analysis|memory-hierarchy|
I am trying to understand an algorithm for solving Closest String using bounded search trees, as found in *Parameterized Algorithms* (Cygan et al., 2015). Assume we have a set of $k$ strings $x_1, ..., x_k$ all of length $L$ and an integer $d$. The problem is to determine if there exists a string $y$ such that $d_H(...
null
Given an array of size $n$. I have the following series $\sum_{k=1}^{n-1} (n-k)$ with $k$ denoting gap of size $1$ to calculate the time complexity of an algorithm of two *for* loops. I want now to add an outer sum to change $k$ with terms of a sequence of gap values. My sequence is the Knuth sequence $S = \frac{3^k-1}...
Shell sort algorithm analysis
|algorithm-analysis|asymptotics|sorting|
Given an array of size $n$. I have the following series $\sum_{k=1}^{n-1} (n-k)$ with $k$ denoting gap of size $1$ to calculate the time complexity of an algorithm of two *for* loops. I want now to add an outer sum to change $k$ with terms of a sequence of gap values. My sequence is the Knuth sequence $S = \frac{3^k-1}...
Given an array of size $n$. I have the following series $\sum_{k=1}^{n-1} (n-k)$ with $k$ denoting gap of size $1$ to calculate the time complexity of an algorithm of two *for* loops. I want now to add an outer sum to change $k$ with terms of a sequence of gap values. My sequence is the Knuth sequence $S = \frac{3^k-1}...
null
null
null
My goal is to find the local minimums of a smooth multivariate function $f_t(\vec y)$ for multiple values of $t$. I have created an algorithm $foo(t,\vec x)$ which returns the results of Newton's Method (by "results", I mean that $foo(t,\vec x)$ returns $\vec a$, where $\vec a$ is a local minimum for $f_t(\vec y)$) on ...
null
*Making* keys the same size doesn't make a huge amount of sense, but fixed-sized keys for key-value stores and database indexes are an important use case. In the real-world, people do sometimes want to search on integers, or IP addresses, or DNA [$k$-mers][1]. If your keys are *naturally* the same size, then this en...
I've been reading a paper "A Linear Time Algorithm for Maximum Matchings in Convex, Bipartite Graphs" by Steiner and Yeomans. In this paper at some point they solve an off-line minimum problem that is stated as follows: You are given an empty set $S$ and a sequence of $n$ $\textrm{INSERT}(i)$ and $m$ $\textrm{EXTRAC...
Linear algorithm for off-line minimum problem
|algorithms|complexity-theory|
I've been reading a paper "A Linear Time Algorithm for Maximum Matchings in Convex, Bipartite Graphs" by Steiner and Yeomans. In this paper at some point they solve an off-line minimum problem that is stated as follows: You are given an empty set $S$ and a sequence of $n$ $\textrm{INSERT}(i)$ and $m$ $\textrm{EXTRAC...
null
The paper ["A linear-time algorithm for a special case of disjoint set union" (1983) by Gabow and Tarjan](https://doi.org/10.1145/800061.808753) gives an $O(m+n)$ time algorithm to process $m$ union and find operations on $n$ elements, under the condition that the _union tree_ is given as well. The union tree is a root...
Given this Shell sorting algorithm implementation: ``` void shell(float ∗a ,int l ,int r) { int i, j, h; for ( h = 1 ; 3∗h <= r−l −1; h = 3∗h + 1 ); for (; h > 0; h / = 3) { // outer loop for (i = l+h; i <= r; ++ i) { for (j = i; j >= l +h && a[j] < a[j−h]; j −= h) { swap (a+j−h , a+ j...
The paper [Linear Temporal Logic and Linear Dynamic Logic on Finite Traces](https://www.cs.rice.edu/~vardi/papers/ijcai13.pdf) has the following examples on page 4: **Q1**. The first example says that the REf (reg-expr over fin words) $\varphi^* \equiv$ ☐$\phi$ [![example 1][1]][1] I disagree: the LTLf formula...
Errors in examples of Vardi's paper "Linear Temporal Logic and Linear Dynamic Logic on Finite Traces"
|check-my-answer|linear-temporal-logic|
The paper [Linear Temporal Logic and Linear Dynamic Logic on Finite Traces](https://www.cs.rice.edu/~vardi/papers/ijcai13.pdf) has the following examples on page 4: **Q1**. The first example says that the REf (reg-expr over fin words) $\varphi^* \equiv$ ☐$\phi$ [![example 1][1]][1] I disagree: the LTLf formula...
When you use a one-time pad, we assume that your one-time pad contains perfectly random numbers, so the encrypted message is also perfectly random, with no way whatsoever to crack it. But if you encrypt two messages with the same pad, the result is the xor of two very non-random messages. So that alone gives an atta...
null
Let G be a grammar with non-terminal `A`, terminal `a` and these productions: ``` A -> A a ``` It is obvious that this grammar cannot be parsed. There is no way to "exit" the parsing process. However, I am not sure at what point I would determine the `LL(1)` property. Let's first look at the `FIRST` set for `A`....
Is this grammar LL(1) and what is it's parsing table?
|formal-grammars|parsers|
{"Voters":[{"Id":-1,"DisplayName":"Community"}]}
null
null
null
null
I read in Algorithms in C by Sedgewick that we can easily prove by induction that *breadth-first search* algorithm computes the shortest path from one vertex to another (unweighted graphs or weighted graphs with edges = 1). I have written the proof below. Is it correct? **Statement** S: Given two vertices $u$ and $...
Prove that BFS computes the shortest path from one vertex to another
|algorithms|graph-traversal|induction|breadth-first-search|
The paper [Linear Temporal Logic and Linear Dynamic Logic on Finite Traces](https://www.cs.rice.edu/~vardi/papers/ijcai13.pdf) has the following examples on page 4: **Q1**. (**Update to Q1**: solved. See the comment by DCTLib.) The first example says that the REf (reg-expr over fin words) $\varphi^* \equiv$ ☐$\phi$ ...
|regular-expressions|check-my-answer|linear-temporal-logic|
null
null