instruction stringlengths 35 29.1k |
|---|
Let's assume that I am continuously receiving big amount of data. For example, this millisecond I get 100 numbers, next millisecond I get another 500 numbers, after that I might get nothing for a several milliseconds and then again get some numbers in the next millisecond. Also assume that this process lasts for weeks.... |
I'm trying to find an optimal combination of players given certain constraints.
There are ~300 players.
10 players has to be chosen in the combination.
Each player has an assigned value. The goal is to optimize for the sum of their values.
Constraints:
Each player has a price. The sum of their prices has to be less th... |
I was playing nandgame.com and noticed that the arithmetic unit of the ALU was doing both the add and subtract operation in parallel, but only asks for one operation per instruction. This to me seemed like it wasted resources, and I was interested in if this was a normal design-pattern in ALUs/CPUs. My question is, bro... |
Let $L_1 \in NP, L_2 \in NPC$. It is known that if $L_1 \in P$ then $L_2 \in P$.
Can we formally deduce that $L_1 \in NPC$ (show that $\forall L'\in NP$ exists a polynomial reduction $L'\leq_p L_1$)?
|
In reading the paper "a strip-packing algorithm with absolute performance bound 2", the author gives a recursion formula $T(l)=T(l')+T(l'')+O(min\{l'\log{l'},l''\log{l'}',l\})$, where $l'+l''=l$,$l'>0$,$l''>0$, I'm confused about the complexity of the recurison formula, how to obtain $T(n)=O(n\log^2(n)/\log\log n)$?
h... |
Let $S$ be an array of length $n$ containing a random permutation of numbers from $0$ to $n-1$. What is the most efficient (in expectation) algorithm for finding the location of a given number $k$ in $S$? In other words, finding index $i$, such that $S[i]=k$.
I watched a video about a related puzzle and it seems that ... |
I have a problem where I have to find all the pairs of a list of People where the sum of their age is equal to a given number under time complexity less than
O(N²)
Eg:
Input:
{(Jhon, 10),(mary,20),(paul,10),(joseph,15)}
Sum:30
Expected results:
{(John, Mary), (Mary, Paul) }
The worst scenario i can imagine is whe... |
I am trying to understand why the ellipsoid method is not a strongly polynomial time algorithm for linear programming. Using wikipedia's definition, an algorithm runs in strongly-polynomial time if:
The number of operations in the arithmetic model of computation is bounded by a polynomial in the number of integers in ... |
Suppose that you are given an algorithm A that finds the optimal solution to the shortest lattice vector problem (SVP) in time $t(n)$
I am trying to solve the Small even set problem (SES) using it:
The input is a set $S$ of $m$ vectors $v_1,...,v_m$ with each $v_i$ in $\{0,1\}^d$. The goal is to find a non-empty small ... |
Question: Use the Pumping Lemma to show $L_1 = \Sigma^*\setminus\{0^n1^n: n\geq 0\}$ is not regular, for $\Sigma=\{0,1\}$.
My thoughts: I understand that $L_2 = \{0^n1^n: n\geq 0\}$ can be shown to be not regular using the Pumping Lemma by starting with a string in $L_2$ of length at least the pumping length, and try t... |
I am reading Slavik's paper A Tight Analysis of Greedy Set Cover. Specifically, Slavik considers the unweighted version of set cover where the ground set is ${U = \{1,\ldots,m\}}$ for arbitrarily large $m$. There is a collection of subsets ${S = \{S_1,\ldots,S_n\}}$ that is a cover of $U$. The goal is to find the sma... |
I am working through the book Computer Systems: A Programmer's Perspective.
The authors explain that round-to-even rounding can be applied for values that are halfway between two possible results. For example, $10.11100_2$ would be rounded up to $11.00_2$ and $10.10100_2$ would be rounded down to $10.10_2$.
In general,... |
just given solution on this post
i had mention the time complexity to convert string to int is O(n), also verifying this post
now in one of comment fellow SO user, corrected me with example also mention in solution, that for every 10x increase in size time is increased by 100x time.
so i found, post where it mention th... |
Are pure functions always computable functions?
In computer programming, a Pure function is a function that has the following properties:
(1) the function return values are identical for identical arguments (no variation with local static variables, non-local variables, mutable reference arguments or input streams), an... |
Gandalf61 mentions here that there are opcodes that "load the next word into Register A", treat the bits at the next address defined by program counter as data and loads this data. I am interested in examples of computers and CPUs that have such as opcode.
Context: Learning basic computer architecture, and interested i... |
I'm studying substitutions. A substitution is a set of mappings from variables to terms $\{a \rightarrow b; c \rightarrow d;...\}$.
Given these substitutions:
$\sigma_1 := \{x \rightarrow y\}$
$\sigma_2 := \{y \rightarrow x\}$
$\sigma_3 := \sigma_1 \cup \sigma_2 $
And this term : $t := f(x, y)$ are following substitu... |
T(1)=1
Func_two (n,b)
1) if (n=0)
2) then return 1
3) else if (n=1)
4) then return b
5) else if (mod(n,3)==0)
6) then return Func_two(n/3,b)
7) else
8) return b*Func_two(n-1,b)
How do I calculate this?
I see that $\mathcal{O}(\log(n))\le T(n) \le \mathcal{O}(n)$ because either we decrease by $1 $ all the time ... |
Question: Use the Pumping Lemma to show $L_1 = \Sigma^*\setminus\{0^n1^n: n\geq 0\}$ is not regular, for $\Sigma=\{0,1\}$ (without using the complement closure property).
My thoughts: I understand that $L_2 = \{0^n1^n: n\geq 0\}$ can be shown to be not regular using the Pumping Lemma by starting with a string in $L_2$ ... |
Question: prove that the grammar $G = (\{S\}, \{(,)\}, R, S)$ where $R$ consists of three rules:
$S \rightarrow (S)~|~SS~|~\epsilon$
generates precisely all well-balanced parentheses.
I found a source where it used induction on the length of string and the length of CFG derivation.
First of all, it seems for the backwa... |
This is about unrestricted grammars
Assume S is the start symbol. Assume 1 and 0 are terminal symbols. Assume all other symbols are non-terminal.
Given a set of (non-trivial) grammar rules,
is it always possible to order them, such that,
all the symbols on the left:
will be contained on the right in a previous rule
or... |
Disclaimer 1: I am a beginner in this domain and I am self-learning these concepts. Please take this in consideration when reading my question.
Disclaimer 2: All corrections to this question are highly encouraged. All self-learning PDF books etc. that helped you better understand these particular concepts are highly de... |
I understand that in Heaps we add them from left to right. I understand how to add and delete. But why is it from left to right, is there something that prevents it from being right to left or something like that. My intuition tells me that it has something to do with the index.
|
in a single board computer built around a 8085 processor, like in the old arcade/pinball games - what is the “role” of the EPROMs - am i correct, that they contain the code that the microprocessor runs..? i am most wondering if they are only active at turn-on, sending an instruction set to the microprocessor just once.... |
I am reading Introduction To Theory of Computation by Sipser, 3rd Edition and am confused by his take on the last three cases of proving that "if a language is described by regular expression then it is regular" on Page 67.
I don't understand how this proof guarantees that there will be an NFA for R1 and R2 in the firs... |
I thought up this problem and am trying to come up with an optimal solution.
I am thinking of a number uniformly randomly between 1-100, inclusive.
If you guess the number, you "win".
Else if you guess incorrectly, but are within 10 of the number, I will tell you "hot".
Else, I will tell you "cold".
For example, if ... |
I am currently being introduced to algorithms and I am trying to learn about showing the correctness. For training I chose the very basic linear-search algorithm and I would like to know if this is a correct proof. Thank you for your feedback!
Algorithm-Pseudocode:
function LinearSearch(Array A, int v):
for j=1 in A.... |
Question: Prove that the 6-rule CFG for arithmetic expressions below is unambiguous.
The CFG is as follows. $G = (V:=\{E,T,F\}, \Sigma:=\{+, \times,(,),x\},R,E\})$
where $R$ consists of 6 rules:
$E\rightarrow E+T ~|~ T~~~~~~ T\rightarrow T\times F|F~~~~~~ F\rightarrow (E) | x$
My thoughts: I think we should start by sh... |
Given a permutation $P$ and an integer $k$, we need to devise an algorithm which finds the $k$ disjoint increasing subsequences (say $L_1,L_2\ldots, L_k$) such that the sum total of their lengths (say $S_k$) is maximum is over any choice of $k$ disjoint increasing subsequences from a permutation $P$. For simplicity, on... |
I've had lectures and read other threads claiming that $k$-means clustering is NP-hard. The fact that they never mention NP-completeness makes me suspect that strict NP-hardness is what's meant. This makes intuitive sense to me: problems in NP can be verified in polynomial time w.r.t. the input, and it seems like recei... |
It's a widely known fact that $\lambda n. \left\lfloor \lg n! \right\rfloor \in \mathcal{O}(\lambda n. \left\lfloor \lg n \right\rfloor!)$. Is it also true (I tried and haven't found a counterexample so far) for all functions $f$ and $g$ satisfying $f \in \mathcal{o}(g)$, not just $f(n) = \left\lfloor \lg n \right\rflo... |
I have a vector of 2D Euclidean coordinates, and I need to find out if two or more points are within a distance threshold.
The naive approach is to compare each point with every other point, but I am not interested in O(n2) solutions. There are no other information or data that can be used to restrict the search space.... |
I have this NFA:
1,{2, 3}
2,empty
3,{4}
4,empty
All the arrows in this NFA are epsilon-arrows.
I understand that all possible states that can be reached from each of the states, using only epsilon paths are these:
E(1) = {1,2,3,4}
E(2) = {2}
E(3) = {3,4}
E(4) = {4}
However I don't understand how this state set was ac... |
This is a question from a previous exam in Graph theory and algorithms, the correct answer is E but I don't understand why.
Given a network flow $(G,c)$ over graph $G(V,E) $.
Assume we run Edmonds-Karp algorithm to find the max flow with the Max Bottleneck approach.
After $\frac{|E|}{2}$ iterations we decide to stop th... |
in "Introduction to Automata Theory, Languages and Computations" by Motwani, Ullman and Hopcroft, when they need to prove, for instance, Rice's theorem, they reduce the universal language, $L_u$, to the language $L_p$, where the latter is defined as the language containing the codes (binary) of all the TM $M$ such that... |
Some ISA's have instructions that are multiple words, such as the MOV instruction in x86. How does the program counter behave in that case, if the instruction loaded is more than one word? For example, the 5 byte MOV eax, 0x11223344 in x86, encoded as B8 44 33 22 11. In the case of that example, I would assume PC (EPI ... |
In graph theory, the lexicographic product or (graph composition) $G ∙ H$ of graphs $G$ and $H$ is a graph such that
the vertex set of $G ∙ H$ is the cartesian product $V(G) × V(H)$;
and any two vertices $(u,v)$ and $(x,y)$ are adjacent in $G ∙ H$ if and only if either $u$ is adjacent with $x$ in $G$ or $u = x$ and $v... |
PRNGs (pseudorandom number generators) generally have a bit length for the binary numbers they generate (e.g. 32 bits, 64 bits). This is the universe of their possible numbers.
It seems that they typically cycle when they reach their 2^bitlen number.
Is there one that, before it cycles, will generate each possible numb... |
I'm not convinced that substitutions are associative, I read the https://en.wikipedia.org/wiki/Substitution_(logic)#First-order_logic and the https://www.youtube.com/watch?v=_cVNeccMF-E
My problem is in this case, I use $\Rightarrow$ to mean reduces to
$( f(X,Y)\{X \rightarrow Y\} )\{Y\rightarrow X\} \\
\Rightarrow f(Y... |
Goal is proving grammar equivalence
Upper-case symbols are non-terminal.
Lower-case symbols are terminal.
The start symbol is S.
A grammar production rule is non-terminals-only if it only contains non-terminals. For example: AB -> CDE
A grammar rule is non-terminal-to-terminal if the left side has one non-terminal and... |
Background: How Percentile Approximation Works (and Why It’s More Useful Than Averages)
In traditional scenario, we store each value in an array/slice, in that case, we can just sort the array, and get the approximate percentile. For example,
[67, 68, 70, 71, 76, 78, 78, 79, 80, 98]
We could get the p90(90th percentil... |
Given a set B and B’s superset A, if B is missing 1 number (let’s y) but don’t know which number it is, how to find that number?
That is,
B’ = B \ {y}, for some unknown element y
B = A \ {x}, for some unknown elements x
I’d like to know y.
The original context is from Problem6,
Miners A and B each have a set of tr... |
Consider simple random walks that stop when reaching a given node $x$ in an undirected, unweighted and connected graph on $n$ nodes.
Let
$H(i,x)$ denote the (expected) hitting time from $i$ to $x$, with $H(x,x)=0$.
$H_{\max} = \max_{i \in V} H(i,x)$ and $H_{\text{avg}} = \frac{1}{n}\sum_{i \in V} H(i,x)$.
I am intere... |
Suppose you have to prove the solution to the following recurrence by Induction,
$$
T(n)=
\begin{cases}
\Theta(1), & n=1 \\
2 T(\lfloor n/2 \rfloor)+\Theta(n), & n>1
\end{cases}
$$
Here, $\Theta(1)$ and $\Theta(n)$ are notational abuse and they represent arbitrary positive constant and arbitrary linear function respec... |
For $1\ge p_1 \ge \dots \ge p_n \ge 0$, and for $i\in[n]$ draw $k$ iid binary strings with $m$ length:
$$X_{i,1},\dots,X_{i,k}\stackrel{iid}{\sim} \text{Bernoulli}(p_i)^m.$$
Viewing these binary strings as integers, define their ranks as
$$\text{rank}(i,s):=\#\{j\in[n]:X_{j,s}\ge X_{i,s}\}, \qquad \text{MinRank}(i):=\m... |
I have found this question some time ago. While reading it, I had a problem with understanding the following idea:
Question, part 1: Is one allowed to talk about the time/space bound of any algorithm (e.g. the $O(n)$ time bounded algorithm proposed in the cited question's comments) without considering at least one conc... |
Data only accessible in a scope, seems to still be maintained by the stack. What is the reason that entering and exiting scopes (in general) does not do the same "prologue and epilogue" instructions that are done when entering and exiting functions?
What test1 and test2 show, in test2 8 byte is allocated in the stack, ... |
I got interested in one problem. I have $N$ rocks, where rock with minimum weight have number equal to $1$, the next heaviest stone has a number equal to 2, etc..
So a rock with maximum weight have a number equal to $N$. And I have $N$ requests, each of N request contains two integers: $R$ $(1≤R≤N)$ and $S$ $(1≤S≤2)$.... |
Let P be the complexity class of languages decidable by Turing machines running in polynomial time. Say a prefix $s$ of a string $x$ is a long prefix (or an L prefix) if $|s|\ge |x|/2$. For a language $A$, let $LP(A)$ be the language of all L prefixes of strings in $A$. Show that $P$ is not closed under $LP(\cdot )$ u... |
Huffman coding follows a bottom-up approach where as Shannon-Fano coding is top-down. Is that contrast similar to dynamic programming versus greedy algorithm (dynamic programming always give optimal solution whereas greedy algorithm is sub-optimal)? If yes why is Huffman called greedy? Why greedy algorithm can also be ... |
Given a typical popular programming language, its native type theory is a dependent type theory which describes invariants, preconditions, predicates, and other generalizations of typical type-system features. The title says it all: what are some strong examples of popular languages which have a type system that can't ... |
Input: A TM $M$ and an integer $k$.
Output: Yes if $M$ halts within $2\uparrow\uparrow k$ steps (where $\uparrow\uparrow$ is tetration (iterated exponentiation)).
Intuitively, it seems like this has to be NONELEMENTARY (and its decidability is immediate) from the undecidability of the halting problem.
I'm asking becau... |
I know the circuit depth (i.e. amount of sequential operations on the longest path) for long multiplication can easily be made $O(\log(n))$ (possibly at the cost of increasing the computational complexity by a small constant factor), and I’m pretty sure the same applies to Karatsuba and Toom-Cook. However, I don’t unde... |
The concept of brain computer implants assumes that there's some net positive for either a machine or the brain when it comes to calculating or computing things. Usually there is a focus on what the computer can do for the human brain, but this takes the reverse. Essentially what exactly can the human brain do for a co... |
Consider the decision LWE setting, where we have to distinguish between $(A, As + e)$ and $(A, u)$, for a randomly chosen $m \times n$ matrix $A$, an $n \times 1$ secret vector $s$, an $m \times 1$ Gaussian secret vector $e$, and a randomly chosen $m \times 1$ vector $u$.
In many places, a "lossy version" of the settin... |
So if someone proves with an algorithm that SAT can be solved in deterministic polynomial time, then P = NP and that's it?
|
The "Hack CPU" (Wikipedia/Hack_computer) is a theoretical computer design created by Noam Nisan and Shimon Schocken and described in their book and also used in their Coursera course Nand2Tetris, and in the game https://nandgame.com. Their CPU only has two registers, A and D. Both registers are loaded via the output of... |
Consider this "generalized halting problem":
$$
GHP = \{<M>| \mbox{ there are infinitely many inputs that $M$ halts on}\}.
$$
I'd like to prove that $GHP\notin RE$, but it doesn't seem straightforward easy.
Any ideas?
My first thought was to try the opposite: suppose that there were at most $k$ halting inputs. Then we... |
I assume that computers make many mistakes (like errors, bugs, glitches, etc.), which can be observed from the amount of questions asked everyday on different communities (like Stack Overflow) showing people trying to fix such issues.
If computers really make many errors (as I assumed earlier) then critical tasks (like... |
The complexity class $\mathsf{BPP}$ is typically defined as the class of all problems for which:
Running an algorithm once takes polynomial time at most.
The answer is correct with the probability at least $2/3$.
The complexity class $\mathsf{PP}$, on the other hand, has $1/2$ instead of $2/3$ in the second constrain... |
I've got a bit of a puzzle here that sits at the intersection of mathematics and technology. Hopefully this doesn't fall into brainteaser territory - I'm not sure a neat solution is possible!
I have two devices. Each one has a short token they would like to share. I am happy for either device to get the other's token; ... |
Let Q be a symmetric transition probability matrix on states 1 , . . . , n; that is $q_{i,j} = q_{j,i}$ for all i , j.
Consider a markov chain defined as follows. Whenever the chain is in state i, the value of a random variable $X_i$ with probability mass function $P(X_i = j)= q_{i,j}$ is generated; if $X_i = j,$ then ... |
There is a list of 3-dimensional points $(x_1,y_1,z_1),\ldots,(x_m, y_m,z_m)$, where all coordinates are non-zero integers.
I would like to decide whether there exist positive real weights $w_x, w_y, w_z$ such that, for all $i$ in $1,\ldots,m$,
$$
(*) ~~~~~~~~~~~~~~ w_x x_i + w_y y_i + w_z z_i \geq 0.
$$
Here is an ... |
Suppose I have the following code and I'd like to compute running time as function of $\ n$:
sum = 0
i = n
while i >= 1:
y = 1
while y < i:
y = y * 2
i = i-1
I think the y loop is running from $\ 1 $ to $\ \lceil \log_2(i) \rceil +1 $ and the outsider loop is from $\ n $ to $\ 1 $ so it should be... |
If we add backspace to the output alphabet, are all the languages produced still context-free? (If not, then what are they?)
The word (a, b, c, Backspace, Backspace), for example, gets interpreted as a.
|
I have been wanting to learn more about how computers work. Getting way ahead of myself, but as in would it be possible to build a computer from scratch by myself? I mean build the individual parts and everything that goes into it. I understand that this question is more on the side of computer engineering but I though... |
Suppose we have a 6 vertices graph. We also have 6 gates. Each gate is attributed a path.
For example,
Gate 'A' will have to go to 'B'- 'C' - 'D' and 'E'
Gate 'B' will have to go to 'D'
Gate 'C' will have to go to 'A' and 'B'
Gate 'D' will have to go to 'E' - 'A' and 'B'
Gate 'E' will have to go to 'C' - 'E' and 'A'
Ga... |
The concept of reducibility in computability theory is very confusing for me.
For example, as described in Micheal Sipser's Introduction to the theory of computation, I understand that if language A is reducible to B, then solving A cannot be harder than solving B, or in other words, solving B gives a solution to A.
Th... |
The lowest time complexity of search algorithms for sorted lists is $$O(n)=logn$$.
The lowest time complexity of sorting algorithms is $$O(n) = nlogn$$
So in order to be able to use a search algorithm for sorted lists we first must sort the list which takes min of $$nlogn$$ time complexity.Since the brute force search... |
I would like to generate helpful parser errors, telling the user how to fix their program.
Specifically I have a deterministic context-free language $L$, given in the form of an $LR(1)$ grammar. I have a syntactically invalid string $w$ (i.e. $w \not\in L$). I would like to find some $w^* \in L$ which minimizes the edi... |
This is about memory, not files or filesystems.
So in a typical process, imagine you have a string "Hello world" that later gets changed to "Hello". Or a list of 100 objects later gets reduced to 50. Or a dynamic array, or other datastructures.
This produces wasted space in memory. It's not solved with virtual memory b... |
I needed to implement a priority queue for a project I'm working on and had this idea. In a priority queue BST implementation wouldn't it be more efficient if the poll node pointed to its parent since it's guaranteed to not have a left child? This would make polling faster since we don't have to traverse the tree to fi... |
What is the difference between this two pseudocode and which one should i implement?
function A*(start,goal)
closedset := the empty set % The set of nodes already evaluated.
openset := set containing the initial node % The set of tentative nodes to be evaluated.
g_score[start] := 0 ... |
When we use a set for doing Dijkstra's Algorithm, we use a pair of {distance,node} which we insert in a set. Most of the articles say that the first element of pair should be the distance , else we need to use a custom comparator, but why in the case of set if we use pair of {node, distance} the code still works. Anoth... |
Note: I had posted this question on Stack Overflow, and got a suggestion to post it to CS Stack Exchange.
The original question:
You are given a list A of N integers. Here, N is an even number. These integers must be distributed into N/2 pairs and the power of each of the pairs is added.
The power of a pair P(i,j) co... |
I have been reading AIMA by Russell and Norvig, where they talk about different types of environments an agent may encounter. Here, they have described stochastic and non-deterministic environments being different types of environments.
One final note: our use of the word "stochastic" generally implies that uncertaint... |
I've seen a lot of mechanical computers based on gears and rigid rods, but none so far that consequently use belts (not chains) for transmission of information.
Belts allow for easy negation (by crossed belts), simple logic gates (using different contact pressures of the belt on the green wheel or shaft), and even one ... |
Is it true that simulating classical physical systems is in P, i.e. can be done efficiently on Turing machines or are there known exceptions? I'm thinking of chaotic systems but I'm also curious more generally whether there are theorems or counterexamples.
|
I have been studying the Branch and Bound paradigm. I came across an approach to solve the Travelling Salesman Problem using branch and bound where a specific kind of bounding function was used. I've been wondering why this bounding function (which performs a kind of reduction on the adjacency matrix of the graph under... |
I'm reading this slides from a MIT course on parallel software performance. They introduced the concepts of Work $T_1$, Span $T_\infty$ and Parallelism (ratio $T_1/T_\infty$). What is called ''Parallelism'' here can be interpreted, according to the same authors, as the maximum possible speedup that can be achieved on a... |
I have a problem that can be reduced to an assignment problem. (this is related to some cryptography problems)
Which means we have a set $A$ of $n$ agents and an equal size set $T$ of tasks as well as a cost function $c(i,j)$, and one wants to find a bijection $\sigma: A\to T$ that maximizes the satisfaction of the age... |
I've been working with Bresenham’s Algorithm in 2D and understand it is derived from the following logic:
y = mx+c
To get the slope error at a given point, the following equation is used:
d2 is the distance from value Y to the whole integer above.
d1 is the distance from value Y to the whole integer below.
d1 - d2 = [m... |
According to the Wiki article on NP-Completeness, NP-Complete problems can be solved in $O(c^{n^k})$ time (I'll call this EXP-POLY time). However, shouldn't the bound on all their run times be the tighter $O(c^n)$ time (I'll call this simply EXP time)?
I ask because, for example, for the Traveling Salesman Problem, we ... |
Suppose, for the sake of argument, that it was proved that $P \not= NP$. Then, this would imply that for every $NP$-complete problem, there is a "hardest instance" of the problem that cannot be solved in polynomiall time. Then, if $P$ were to not equal $NP$, what properties would be known about the hardest instances ... |
Basically, I need to solve the multivariate case of the "closest subsequence sum to a given value K" problem, which is solved with dynamic programming as far as I understand. Let's say I have M rows of integer data.
A = [
[a11, a12, .., a1n],
...
[ai1, ai2, .., ain],
...
[am1, am2, .., amn]
]
And I have a target vect... |
Prove that the unique language $A\subseteq \Sigma^*$ such that $AB$ is context free for all languages $\subseteq \Sigma^*$ is the empty set.
If $A$ is not the empty set, there should be a way to construct a language $B$ so that $AB$ is not context-free. I'm not sure how to generalize this for arbitrary nonempty langu... |
I have learnt about both articulation points and bridges and I have understood the algorithm used to find the number of bridges in O(n) time which is Tarjan's algorithm. But now, can I simply say that the vertices connecting the bridges are the articulation points with the additional condition that they should have deg... |
Let $G$ be a vertex-labeled directed graph with unique labels $L$. Let $G_P$ be a path graph with the same vertex labels and the same number of vertices as $G$.
I know that in the general case computing the Graph Edit Distance is NP-hard (if approximations are excluded) and APX-hard to approximate.
I'm interested in a ... |
I am trying to understand the reason as given in this answer
If an ε-free grammar is not LR(0), then there is some state with both a shift and a reduce
action. Since the grammar is ε-free, that state was reached by way of a shift or a goto. The previous state must then have had two different productions with the same ... |
I am reading the book "Cracking the coding interview". In Chapter 4 they cover basic tree concepts.
It says there that a complete binary tree is a binary tree in which every level of the tree is fully filled, except for perhaps the last level. To the extent that the last level is filled, it is filled left to right. Thu... |
I'm learning about computability problems e.g. reducing the general halting problem to the halting problem on a blank tape. But before I can understand this problem I first have to understand what exactly $M_w$, $M_w[\epsilon]$, and $M_w[w]$ are.
I know the concept of encoding a Turing machine $M$ e.g. by generating a ... |
You are playing with boxes on a $K_{1, n}$-$\textbf{subdivision}$ graph $G:=(V, E)$ whose number of vertices is odd, i.e., $|V| \equiv 1$ (mod $2$) with a given central point $C$ such that $\forall v \in V - \{C\}, deg(v) \leq 2$. Actually, $C$ is the center of the star graph $G$. Your goal is to move $n:= (|V| - 1)/2$... |
Problem
This is a HW problem from CMU 15-455 (hw10, p1(a)), spring 17 by Ryan O'Donnell.
Assume $L \in {\sf RP \backslash ZPP}$. Define
$$ L' = \left\{ (x, y) : \text{either $x \in L$ and $y \notin L$, or vice versa} \right\}, $$
Prove that $L' \notin {\sf RP} \cap {\sf coRP}$.
My Thoughts
The path of this proof is cle... |
I have an operation that is performed many times and is thus performance sensitive where I need to calculate product of a matrix and inverse of a matrix as below. Both matrices are 4x4 and consist of floats.
M3 = Inverse(M1)*M2
Now in this specific scenario M1 and M2 very often equal each other. Let's say 75% of the ... |
This is a purely theoretical question: among the known flood fill algorithms, there is one which does not require any dynamically-sized data structures, explicit or implicit: the so-called Walk-based filling, expressed there in structured English, e.g.
...
while front-pixel is empty do
move forward
end while
jump ... |
A Markov chain $\{ X_n, n \geqslant 0\}$ with states 0, 1, 2 has the transition probability matrix $$P= \begin{bmatrix} \frac12 & \frac13 & \frac16 \\ 0 & \frac12 & \frac23 \\ \frac12 & 0 & \frac12 \end{bmatrix}$$
If $P\{X_0 =0 \} = P\{X_0=1\}=\frac14$ find $E[X_3]$
How to answer this question?
|
I'm looking for good introductory resources (books, articles, notes, websites, videos, e.t.c.) on polyhedral compilation. I'm especially interested in applications related to deep learning / GPU computation acceleration.
Thanks in advance.
|
I have searched for a bit eventually arriving at well known websites like codeforces, atcoder, codewars, codinggame or the various OJs.
They mostly involve solving tasks where usually the main focus is elementary discrete maths + data structures and algorithms.
However, I cannot find any that target the more theoretica... |
How does one formally prove that, given a DFA $M=\langle Q,T,\delta,q_0,F\rangle$, the following NFA $M^R = \langle Q_R, T, \delta_R, q_R, F_R\rangle$ recognizes the reverse of M's language?
We build $M^R$ like this:
$Q_R = Q \cup \{q_R\}$, where $q_R$ is a new state which will be the start state of $M_R$
$F_R = \{q_0... |
Suppose that $P \not= NP$. Then my understanding is not all instances of NP-complete problems can be solved in polynomial time. That is for every NP-complete problem, there are a colleciton of instances of that problem where the solution (correct certificate) cannot be determined in polynomial time (I do not mean that ... |
In linguistics, the word 'statement' means something that is true or false, closer to a declarative sentence, but in programming, the meaning is closer to an imperative sentence.
What is the reason for this difference?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.