instruction
stringlengths
0
29.8k
⌀
I am a research scholar working in algorithms and complexity theory. The problem that I am currently working on is the $[1,j]$-domination problem. Given a graph $G = (V, E)$, $n = |V|$, the problems asks to compute a minimum dominating set $D$, such that all the vertices outside the solution set $D$ has at most $j$ ver...
Role of the variable in problem definition in time complexity
|algorithms|graphs|polynomial-time|
The scope of variables created with the `var` keyword in JS is pretty unintuitive, at least if you're already familiar with how other languages handle scope. You can get some more info on how closures and scope interact in JS on this page --> [Closures - JavaScript | MDN][1] In this case, the problem is that a pair ...
I am a research scholar working in algorithms and complexity theory. The problem that I am currently working on is the $[1,j]$-domination problem. Given a graph $G = (V, E)$, $n = |V|$, the problems asks to compute a minimum dominating set $D$, such that all the vertices outside the solution set $D$ has at most $j$ ver...
I am a research scholar in the field of algorithms and complexity theory. The problem that I am currently working is the $[1,j]$-domination problem. Given a graph $G = (V, E)$, $n = |V|$, the problem asks to compute a minimum dominating set $D$, such that all the vertices outside the solution set $D$ have at most $j$ v...
If you don't need a cryptography-proof solution, add a 32 bits number, then scramble the bits. This is easy to invert.
I am a research scholar in the field of algorithms and complexity theory. The problem that I am currently working is the $[1,j]$-domination problem. Given a graph $G = (V, E)$, $n = |V|$, the problem asks to compute a minimum dominating set $D$, such that all the vertices outside the solution set $D$ have at most $j$ v...
Role of a variable in problem definition in time complexity
null
These parts of the algorithm are discussed in the book _Computational Geometry_ by de Berg et al. I will provide a summary here. Let $P$ be the set of input points. > 1. Make 3 points that are large enough to contain all other points. This is not sufficient<sup>1</sup>. We need to find three points (some of them...
I am a research scholar in the field of algorithms and complexity theory. The problem that I am currently working is the $[1,j]$-domination problem. Given a graph $G = (V, E)$, with $n = |V|$, the problem asks to compute a minimum dominating set $D$, such that all the vertices outside the solution set $D$ have at most ...
> Can I say that the problem is polynomial time solvable for graph class $C$? Yes, you can say that if you want to. > Should I always consider j to be a constant, can't it be some function of n that ruins everything? This is something we usually state explicitly, however, if you call the problem the $[1, 5]$-D...
Currently I'm exploring LALR(1) lookahead generation algorithms to implement. I've implemented Aho and Ullman one from their textbook, but recently stumbled upon "A new analysis of LALR formalisms" paper by Park, Choe, Chang. There they propose an efficient algorithm (commonly referred to as PCC) and provide proofs,...
Any reference implementation of PCC algorithm out there?
|parsers|lr-k|
Mutual exclusion means that during some time, a certain piece of code (called a critical section) has exclusive control over a resource. Interrupts can break that because they cause control to be transferred from critical section to the interrupt handler. Code running on other processors can break that because they can...
null
Assume we have a set of $s$ vertices, say $\{w_1,\ldots,w_s\}$. Assume every vertex $w_i$ has at most $q$ neighbours coloured either red or blue, for some positive integer $q\ge 1$. I would like to check how many neighbours of each colour $w_i$ for each $i\in \{1,\ldots,s\}$ has. What is the complexity of doing it? ...
Complexity of checking whether the vertex has more vertices of blue or red color
|complexity-theory|graphs|
null
I've been playing Bananagrams recently, and have begun to wonder about the math behind it from a computational perspective. I've tried to formalize the problem as a decision problem below. Loosely formal definition: Given a set (alphabet) **$A$** of letters, a dictionary **$D \subseteq \mathbb{P}(A)$** of valid s...
Bananagrams decision problem - computational complexity
|complexity-theory|combinatorics|board-games|
One classic fair division allocation problem is to allocate indivisible goods among agents with respect to envy freeness (no agent envies another agent). In my settings, all the goods are divisible (we can split the goods), but we restrict the number of shared goods to one. So only one good can be split, but the spl...
Which good should I split?
|game-theory|
null
I've been playing Bananagrams recently, and have begun to wonder about the math behind it from a computational perspective. I've tried to formalize the problem as a decision problem below. Loosely formal definition: Given a finite set (alphabet) **$A$** of letters, a finite set (dictionary) **$D \subset$(Set of a...
null
I've been doings some research into distributed solutions for a large system of linear equations (reading papers such as Wang et al.'s "Solving a system of linear equations: From centralized to distributed algorithms"). Before implementing a solution myself I wanted to see if there are already any free or paid implemen...
Are there free/paid DISTRIBUTED solvers for a large system pf linear equations?
|optimization|distributed-systems|linear-algebra|
[LeetCode problem 1386. Cinema Seat Allocation][1] requires finding the number of 4-person seating groups available (subject to certain constraints) after individual seat reservations have been made. The problem is tagged by LeetCode as Greedy. The constraints are that there are only 3 permissible 4-person groupings...
Why is the solution to Cinema Seat Allocation considered greedy?
|greedy-algorithms|resource-allocation|
Draw a DFA for the set of all strings with two consecutive 0’s followed by two consecutive 1’s over Ʃ= {0,1}
I have a confusion. Is it must that there must be two 0 and two 1/
|finite-automata|
I have a confusion. Is it must that there must be two 0 and two 1 or string like 0,1,01 etc will be accepted
Assume I generate a random binary tree with a bounded height with $n$ nodes. For a given key we measure the length of its path (them maximum can be $n-1$. So my Question is if there is some distribution to the path length?
What is the depth distribution of the of a random binary tree with n nodes?
|binary-trees|randomized-algorithms|path|
Assume I generate a random binary tree with a bounded height with $n$ nodes. For a given key we measure the length of its path (them maximum can be $n-1$). So my Question is if there is some distribution to the path length?
null
That extra word is the equivalent of having an additional symbol that represents the end of file marker, or storing the size of the decoded block in a header. The "overhead" of $O(1)$ bits can also be understood as $o(1)$ bits per symbol, and is therefore is negligible for the purpose of understanding the compression *...
This describes all strings consisting only of 0s and 1s that contain the substring "0011". For example, these are some accepted strings: * **0011** * 0**0011**0 * 11**0011** These strings are not accepted: * 010101 * 0 * 001001011
null
S-> aSb | bbb A grammar G=(V,T,S,P) is defined as V=s T=a,b S=s P=aSb|bbb
null
Assume I generate a random binary tree with a bounded height with $n$ nodes. For a given key we measure the length of its path (the maximum can be $n-1$). So my Question is if there is some distribution to the path length?
What I need is similar to garbage collection but a bit different, consider the following code: int* large_arr = new int [1000000]; ... int b = large_arr[0]; int c = large_arr[1] * large_arr[2]; //after here large_arr is never used int d = b + c; ... So whether it's possible for c...
Is it possible to automatically detect which variable is not used in future and free those memory?
|compilers|program-optimization|
The C/C++ languages mandate that you explicitly delete the heap-allocated memory, and a standard compiler or IDE will not insert the statement for you. Determining if some variable is still used from a certain point is a basic task for a compiler, though in certain cases it is not possible to determine the "tightest...
The C/C++ languages mandate that you explicitly delete the heap-allocated memory, and a standard compiler or IDE will not insert the statement for you. Determining if some variable is still used from a certain point is a basic task for a compiler, though in certain cases it is not possible to determine the "tightest...
Note that if a number $N$ is a power of a prime $p$ it will be of the form: $$N=p^i \ ,$$ Since $p$ is prime, $p \geq 2$ which implies $i \leq \log_2 N$. We can compute the $i$th roots of $N$ for each $2\leq i \leq \log_2 N$ and check if the resultant number is integer, and eventually if it is a prime. The ...
null
Consider sorting on $n$ distinct elements, where all $n!$ permutations are possible. I think a decision tree for comparison sort can can be uniquely characterized as $T(a,n!)$ where $a$ is the comparison sort algorithm and $n!$ is the number of leaves. I believe there's a bijection between number of leaves and the numb...
Subtrees of decision tree for comparison sort are recurrences?
|algorithms|complexity-theory|sorting|trees|decision-tree|
null
null
Let the running time of an algorithm be $T(m,n)=a^mp(n)$. If $m$ is a growing function of $n$, then $$T'(n)=T(m(n),n)=2^{m(n)}f(n)$$ which can very well be exponential. To keep a polynomial behavior, you need $$m(n)=O(\log(q(n)))=O(\log(n)).$$
null
For now assume that the graph is connected. If the graph contains an odd cycle $C$, then you can build an even walk between any two vertices as follows: Let $v$ the first vertex of $C$. Then for any two vertices $u, w$. Let $P$ be an arbitrary path from $u$ to $v$ and $P'$ be a path from $v$ to $w$. Let $W$ be the wal...
An undirected graph $G=(V,E)$ is "evenly connected" if for every $v\in V$ there's a (not neceserally simple!) path to all the other vertices, **with even number of edges**. Let $G=(V,E)$ be an undirected graph where $3\leq |V|, 2\leq |E|$. We want the minimal number of edges we need to add to $G$ in order to make t...
I'm currently studying Hoare's "Communicating Sequential Processes" (1) and I've come across a concept that I find a bit puzzling. In CSP trace semantics, a process's semantics are described by a subset of finite execution traces that is prefix-closed. The need to indicate a complete computation introduces the 'tick...
Rationale behind prefix-closure in CSP trace semantics
|concurrency|semantics|formal-methods|process-algebras|
So ive already tried lookig at it but i just get O(nlogn) which is not correct there were some clues like using a geometric series where 1/2+2/4+3/8+i/2^i<2 but idk how to implement that what should i do. for i = 1, . . . , n do j = n while j > i do ...
Can anyone help explain why the time complexity for this is O(n)
|time-complexity|asymptotics|big-o-notation|
Assuming that the `do smth` instruction runs in constant time, and ignoring the `return sum` instruction since `sum` is undefined, the overall time complexity is asymptotically upper bounded by the number of iterations of the inner loop. This is monotonically increasing with $i$, so let $2^k$ be the first power of two ...
The inner loop is repeated $k$ times, as long as it holds: $\frac{n}{2^k}>i$, i.e.: $$\frac{n}{2^k}>i \iff \frac{n}{i}>2^k \iff \log_2 \left(\frac{n}{i}\right) > k \ .$$ So we have $\log_2 \frac{n}{i}$ iterations of each outside loop, which means that the total number of iterations is: \begin{align*} \sum_{i=1}...
do { key=true; while(key==true) { swap(&lock,&key); } critical section lock=false; Remainder Section }while(true); void swap(boolean *a, boolean *b) { boolean temp=*a; *a=*b; *b=temp; } How do I prove if it s...
How does this swap instruction achieves mutual exclusion, progress and bounded waiting if it does?
|operating-systems|
Assuming that the `do smth` instruction runs in constant time, and ignoring the `return sum` instruction since `sum` is undefined, the overall time complexity is asymptotically upper bounded by the number of iterations of the inner loop. This is monotonically increasing with $i$, so let $2^k$ be the first power of two ...
Assuming that the `do smth` instruction runs in constant time, and ignoring the `return sum` instruction since `sum` is undefined, the overall time complexity is asymptotically upper bounded by the number of iterations of the inner loop. This is monotonically increasing with $n$, so let $2^k$ be the first power of two ...
Steven's answer's the best but that's too smart and tricky, I'll just use induction if I see this in exam :) proposition: Since $\sum_{i=1}^n\lg (n/i) = \sum_{i=1}^n(\lg n - \lg i )=n\lg n - \sum_{i=1}^n \lg i = n\lg n - \lg (n!)$, we propose $$ n\lg n - \lg (n!) \le cn $$ for $n\ge n_0 > 0,c>0$ induction:...
**Update 3 and corrected answer** There's an error in the linked solution set (see update 2 below), but it can be easily corrected with @Yuval Filmus's suggestion in the question's comment, which further allows us to rule out one of the possibilities mentioned in the solution set. This proof hinges on two facts: ...
null
The inner loop is repeated $k$ times, as long as it holds: $\frac{n}{2^k}>i$, i.e.: $$\frac{n}{2^k}>i \iff \frac{n}{i}>2^k \iff \log_2 \left(\frac{n}{i}\right) > k \ .$$ So we have $\log_2 \frac{n}{i}$ iterations of each outside loop, which means that the total number of iterations is: \begin{align*} \sum_{i=1}...
null
I am trying to understand the pumping lemma and its instrumentation to show a certain language is not regular. My first attempt was the following problem: > Let $L$ be the language of all words that have twice as many $a$s as $b$s. Is it regular? Is it context-free? I attempted the following. First, let $p>0$ be ...
The language of chains with twice as many $a$s as $b$s is regular?
|formal-languages|regular-languages|automata|formal-grammars|regular-expressions|
These are two really different questions, so your second question really should be asked separately. Is the preceding proof correct? Not completely. The lemma says that for some $p$, every word at least $p$ long can be pumped, meaning it can be written as $xyz$ such that all words in $xyy^*z$ are in the lang...
(*Note*: I am posting after reading some possibly related posts because I could not find a fitting solution.) Given some finite set of nodes $S$, where each node $s_i \in S$ has a value $val(s_i) \in [0,1]$ and moreover has a pairwise similarity value to each other node, i.e $sim(s_i, s_j) \in [0,1]$, I want to find...
Subset sum with constraint
|algorithms|approximation|subset-sum|
null
null
Maximum Subset Sum with Pairwise Constraints
|algorithms|approximation|clique|subset-sum|
null
Consider the problem > Show $L = \{ a^{n}b^{m}\mid m \text{ es múltiplo de } n \}$ is not regular. I attempted the following. Assume $L$ is regular. Then there is a natural number $p \geq 1$ such that any $w \in L$ of length greater or equal to $p$ can be written as $w = xyz$ , with $|xy| \leq p$ and $|y| \g...
Prove the language $a^n b^m$ where $m$ is a multiple of $n$ is not regular