instruction
stringlengths
35
29.1k
Why did the sets of languages accepted/decided by a TM get the name Recursively Enumerable and Recursive, respectively?
How would I go about using Cartesian construction to find the intersection between a PDA and a DFA? Is there another term for Cartesian construction? Would it be similar to the procedure for finding the intersection/union of 2 DFAs?
I've been reading about hypercube connection template for parallel algorithms. The general scheme is explained in Designing and Building Parallel Programs by Ian Foster and it's pretty clear. What I don't understand is how it's applied on the merge sort in §11.4 The point I'm most interested is the parallel_merge funct...
If I am given a graph which forms a tree, I am interested in finding a vertex which maximizes the minimum distance to any leaf. I am sure this problem has been studied before. Does anybody know the name of this problem or an algorithm for solving it?
In computability and complexity theory (and maybe other fields), reductions are ubiquitous. There are many kinds, but the principle remains the same: show that one problem $L_1$ is at least as hard as some other problem $L_2$ by mapping instances from $L_2$ to solution-equivalent ones in $L_1$. Essentially, we show tha...
The Kolmogorov complexity of a string $x$ is the size of the smallest Turing machine $M$ that started on empty tape produces $x$. To make it computable, we can add a bound on the time used by $M$ to produce $x$: $C^{t}(x) = \min \{|M| : U(M) = x$ in less than $t(n)$ steps $ n = |x| \}$ And for a nice function $f(n) <...
Why is the laplace transform not popular for image processing convolution? Most textbooks only conver the Fourier transforms.
From that question about differences between Quantum annealing and simulated annealing, we found (in commets to answer) that physical implementation of quantum annealing is exists (D-Wave quantum computers). Can anyone explain that algorithm in terms of quantum gates and quantum algorithms, or in physical terms (a part...
I have laid out the various cases that would make this not a context free language already and proved all but one for this set: \begin{equation} A = \{a^f b^g \mid f = g^2\} \end{equation} I am having trouble trying to explain how if v was a's and x was b's for this problem. Exactly how would I prove that us...
In one of the text book its mentioned that 'running time of this algorithm is 200 computer years'. Can somebody please explain what is the meaning of a computer year?
I'm having a hard time understanding the actual proof of this proposition: $\qquad \mathsf{NP} \subseteq \mathsf{P}/\log \implies \mathsf{P} = \mathsf{NP}$ The sketch of the proof is on slides 6-8 of this PDF. So I let $L \in \mathsf{NP}$. That means that there's a deterministic polynomial-time TM $M^1_L$ s.t. $x \in L...
My teacher describes true quantified boolean formula (TQBF) as an interactive game between two players $\exists$ and $\forall$, and asks us to show a winning strategy for the existential player $\exists$. Can someone describe what this game is? I feel like this is background knowledge I am missing.
A bridge (critical edge) in an undirected graph is an edge whose removal increases the number of connected components. I need to determine all critical edges in an undirected graph, in $O(V+E)$ time. From what I found out, I need to use a modified DF search, but all pseudo-code algorithms I found have low[v] and d[v] w...
I am reading Operating Systems book by Galvin. Galvin explains, what are kernel & user modes, instruction privileges given for both modes & also about mode-bit. But I am interested to know how mode changes from one to another. Basically I want to solve following question : A CPU has 2 modes, privileged and non-privile...
I have been reading up on algorithm for finding the strongly connected components in a directed graph $G=(V,E)$. It considers two DFS search and the second step is transposing the original graph $G^T$. The algorithm is the following : Execute DFS on $G$ (starting at an arbitrary starting vertex), keeping track of the...
I'm looking for something i would call rating functions. I'm searching for some literature about this concept. I'm not really sure about the terminology, but what I mean should be pretty obvious. A type of function that returns a rating of some input. Lets have a function that gets some input and returns a number betwe...
Is the language $ L = \{0^n 1^m \mid n \text{ and } m \text{ are co-prime}\}$ context-free ? I guess that it's not context free because it seems too complicated for a PDA to decided whether 2 numbers are co-prime or not. I tried using the pumping lemma to no avail. Any help would be gladly appreciated. Edit: Here is on...
I have this problem: Let $L_1$ and $L_2$ be two regular languages. Show that $L_3 = \{xx^r : x \in L_1, x^r \in L_2 \}$ is a context-free language. I am unsure how to prove that some language is context-free. Could someone please provide the steps?
Traditionally, linear programming is used to find the one optimal solution to a set of constraints, variables and a goal (all described as linear relationships). Sometimes, when the objective is parallel to a constraint, there are infinite or many equally good optimal solutions. I am not asking about this latter case. ...
I have a problem which I suspect is NP-complete. It is easy to prove that it is NP. My current train of thought revolves around using a reduction from knapsack but it would result in instances of 0-1-Knapsack with the value of every item being equal to its weight. Is this still NP-complete? Or am I missing something?
In an exercise I have to show that minimizing a multivariate polynomial with $n$ variables over the hyper-cube $H = \{ (x_1, \ldots, x_n) : 0 \leq x_i \leq 1 \}$ is NP-Hard. Formally, given $p(x_1, \ldots, x_n)$ and $\alpha$, does $\min_{0 \leq x_i \leq 1} p(x_1, \ldots, x_n) \leq \alpha$? My idea is to reduce it to MA...
I am looking for some sort of temporal logic for expressing invariants in interfaces. Since interfaces do not specify data representation, the invariants must rely solely on the publicly available functions of the interface. For example, suppose we have a simple interface (Java style) Sum: interface Sum { public vo...
It seems, from a quick (and incomprehensive) survey of the literature (e.g. N. Ailon, B. Chazelle, SIAM J. Comput. 39 (2009), 302-322.) that there are many fast algorithms (and constructions) for the Johnson-Lindenstrauss transform: $f \in \mathbb{R}^{d} \to \mathbb{R}^{k}$, for $n$ points in $\mathbb{R}^d$ and $k \in ...
A program takes as input a balanced binary search tree with $n$ leaf nodes and computes the value of a function $g(x)$ for each node $x$. If the cost of computing $g(x)$ is $\qquad \min(\#\text{leaves in } L(x), \#\text{leaves in } R(x))$ for $L(x), R(x)$ the left resp. right subtree of $x$, then the worst-case time c...
I'm reading about MinHash technique to estimate the similarity between 2 sets: Given set A and B, h is the hash function and $h_\min(S)$ is the minimum hash of set S, i.e. $h_\min(S) = \min(h(s))$ for s in S. We have the equation: $$ p(h_\min(A) = h_\min(B)) = \frac{|A \cap B|}{|A \cup B|} $$ Which means the probabilit...
The paper Eventually-Serializable Data Services (PODC'96) presented an eventually-serializable data service. In the abstract, it says: … and generalizes their algorithm (in the related work Lazy replication) by allowing general operations … In section 1.1 (Background of our Work), it says: … Also, their algorithm (...
There is this standard algorithm for finding longest path in undirected trees using two depth-first searches: Start DFS from a random vertex $v$ and find the farthest vertex from it; say it is $v'$. Now start a DFS from $v'$ to find the vertex farthest from it. This path is the longest path in the graph. The questio...
Given a set of n jobs with [start time, end time, cost] find a subset so that no 2 jobs overlap and the cost is maximum. Now I'm not sure if a greedy algorithm will do the trick. That is, sort by cost and always take the next job that doesn't intersect and with max cost between the two. Is this equivalent to a knapsa...
I want an algorithm that calculates which element, among two, appears more often than the other in a sorted array. The array will have only two types of elements. Example : $aaaaaabbb$ Here $a>b$. I have to find an constant time algorithm. Is it possible? The only thing I could come up with was using stack. Push all...
Suppose you have some loop and and integer k: int k = 5; for (int i = 0 ; i < N; i++) { //(*) //do something } The loop invariant at (*) is: $\{ K=k\}$ Does that guarantee that $k$ doesn't change in between iterations? if not, is there any otherway to guarantee that?
So in what complexity class would all decision problems in that class can be transformed into a problem (by many-one reduction) that its solution only involves basic arithmetic operation of multiplication, division, addition and subtraction? So, like this: for every problem, there is input and output (we consider only...
Given a partial ordered set (poset) $S$, is there a known procedure or algorithm to find the set of chains (i.e. subsets of $S$ where every two elements are comparable)? Note: I am asking here instead of math.SE because i'm looking for an algorithm for the problem.
I have a little problem to understand the proof of the Time Hierarchy Theorem (Hennie and Stearns, 1966) that ensures the existence of a language acceptable in $U(n)$ but not acceptable in $T(n)$ for any functions $T(n),U(n)$, such that $U(n)$ is time-constructible and $$n \leq T(n) = o\left(\frac{U(n)}{\log T(n)}\righ...
Given a graph $G = (V,E)$. Is there any algorithm which finds the minimum number of vertices to be removed from $G$ so that every vertex in the graph becomes disjoint, i.e., every vertex is disconnected from every other vertex?
Note that I had asked this question in GIS forum, although it has gotten many up-votes, still has not received any answer. Hope you can break the silence, some collaboration :) Consider a region (2D) filled with lines randomly (following Figure). We are interested in filling the empty spaces between lines includi...
A TM for a recursive language corresponds to our informal notion of an algorithm. as per Automata Theory, Languages and Computation by Ullman et al. Then there are languages called RE and $L_d$, where there exist TM that halts for accepting strings in the case of RE languages. This means that we cannot construct a al...
Let's say we a have flow network with $m$ edges and integer capacities. Prove that there exists a sequence of at most $m$ augmenting paths that yield the maximum flow. A good way to start thinking about this is to imagine that we know the maximum flow already. How can we figure the sequence of $m$ paths?
Basically, is the following statement true? $A \leq_p B$ $\rightarrow$ $B \leq_p A$
Given an unweighted DAG (directed acyclic graph) $D = (V,A)$ and two vertices $s$ and $t$, is it possible to find the shortest and longest path from $s$ to $t$ in polynomial time? Path lengths are measured by the number of edges. I am interested in finding the range of possible path lengths in polynomial time. Ps., th...
You have an array of $n$ distinct elements. You have access to a comparator (a black box function taking two elements $a$ and $b$ and returning true iff $a < b$) and a truly random source of bits (a black box function taking no arguments and returning an independently uniformly random bit). Consider the following two t...
If there is an interrupt from every keypress (or one for keydown, one for keyup, one for keypress?) how does the OS handle so many interrupts at the same time. A person typing at 120WPM would be sending more than 500 interrupts per minute. How does a process ever finish if there is a context switch for the CPU to handl...
In database query processing, the approximate time for selection operation using primary index when equality is on key is $2(b_s + b_t)$ where $b_s$ is disk seek time and $b_t$ is disk transfer time (assuming one level of indexing), because one seek and transfer time will be needed for finding the index and another one...
There is the complexity class ELEMENTARY that captures all problems that can be solved by using elementary recursive function only. So if algorithms for solving problems in some complexity class (e.g. NP or P) are converted to elementary recursive function form, would they retain time complexity of the complexity class...
I am studying some old past test questions. Is this search tree correctly pruned?
Following question was asked in one of entrance exams for a graduation programme. Please help me try to solve it : A computer system has an L1 cache, an L2 cache, and a main memory unity connected as shown below. The block size in L1 cache is 4 words. The block size in L2 cache is 16 words. The memory access times are...
Specifying formal languages by giving formal grammars is a frequent task: we need grammars not only to describe languages, but also to parse them, or even do proper science. In all cases, it is important that the grammar at hand is correct, that is generates exactly the desired words. We can often argue on a high-level...
$L = \{a^i b^j a^k \ | \ k > i + j\}$ Use the pumping lemma to show that this language cannot be accepted by an FA. Proof: Suppose $L$ can be accepted by an FA. Suppose a string $s = xyz \in L$, where $$\begin{align} &x=a^n \\ &y=b \\ &z=a^{n+2} \end{align} $$. Then a string $t = a^n b^i a^{n+2}$ should also be in ...
I understand that any CFL can be accepted by a PDA by final state or empty store but I have been rather stumped by this question. The question states that the PDA has at most 2 states. Clearly 1 will be the start state while the other will be the final state (they cannot be the same since otherwise the empty string wil...
As I understand the convoy effect, in the context of vehicular traffic in a road system. A slow moving group of vehicles passes through the system, slowing traffic even in areas which were not directly affected by the convoy. How does this apply in the context of CPU scheduling? It does not seem to be an analogous situ...
In the proof of Trakhtenbrot's theorem (as given in "Elements of Finite Model Theory" by Leonid Libkin), for every Turing machine $M$, author constructs a FO sentence $\Phi_M$ of vocabulary $\sigma$ such that $\Phi_M$ is finitely satisfiable iff $M$ halts on the empty input. Then he says that as the latter is known to ...
Given a context-free language $L$, define the language $p(L)$ as containing all permutations of strings in $L$ (i.e. all strings in $L$ such that the order of symbols is not important). Is $p(L)$ context-free? I found two papers dealing with similar, but not identical, questions: Generating all permutations by context...
A Hidoku is a $n \times n$ grid with some pre-filled integers from 1 to $n^2$. The goal is to find a path of successive integers (from 1 to $n^2$) in the grid. More concrete, each cell of the grid must contain a different integer from 1 to $n^2$ and each cell with value $z ≠ n^{2}$ must have a neighbor cell with value ...
GeoQuery is a dataset used for benchmarking semantic parsers. It contains 880 queries about USA geography. The queries are in Prolog format, for example: answer(A,longest(A,(river(A),traverse(A,B),const(B,countryid(usa))))) (this represents a question for the longest river that passes through the us). I have read sev...
I have a homework problem that says: For $g(x,y)=xy-5$ compute $h(x) = \mu y(g(x,y))$ and determine its domain. I was under the impression that this means the least y such that $g(x,y)=0$, so then $y = \frac{5}{x}, D=\{x \in \mathbb{N}, x \neq 0\}$ So $h(x)=\frac{5}{x}$?
The Situation I'm trying to read the book 'Digital Design Computer Architecture'. In the part of Performance Analysis(7.3.4 in the book), Author refers to clock cycle for MIPS single cycle processor. But I think there's something wrong with author's evaluating clock cycle. Author says, T(Clock cycle) = T(pcq_pc) + T(...
Let $m$ be the number of states (without the halting-state) of a deterministic turing-machine with $\Sigma$ = {} and $\Gamma$ = {$\square$, 0, 1}. Let $G(m)$ be the maximum number of ones, which can be generated by a deterministic turing-machine, before going into the halting-state. Prove that $G(m)$ $\in$ $\Omega(2^m)...
Given a positively weighted DAG (directed acyclic graph) $D = (V,E)$, can you create a new non-weighted DAG $D'$ by converting each edge with weight $w(e) = x$ into x non-weighted edges and vertices? I believe this would take $O(|E|+W)$ time where $|E|$ is the number of edges and $W$ is the total weight of all edges. M...
There exist efficient data structures for representing set partitions. These data structures have good time complexities for operations like Union and Find, but they are not particularly space-efficient. What is a space-efficient way to represent a partition of a set? Here is one possible starting point: I know that th...
Given is a planar graph $G=(V,E)$ and let $\mathcal{G}$ denote its embedding in the plane s.t. each edge has length $1$. I have furthermore a set $C$ of points where each point $c \in C$ is contained in $\mathcal{G}$. Furthermore, it holds for any point $p$ in $\mathcal{G}$ that there exists a $c \in C$ with geodesi...
For a regular language $L$, let $c_n(L)$ be the number of words in $L$ of length $n$. Using Jordan canonical form (applied to the unannotated transition matrix of some DFA for $L$), one can show that for large enough $n$, $$ c_n(L) = \sum_{i=1}^k P_i(n) \lambda_i^n, $$ where $P_i$ are complex polynomials and $\lambda_i...
I have difficulties in understanding the notion of density for distribution. Notion of density for distribution. A distribution $H$ over $\{0,1\}^n$ has density $\sigma$ if for every $x \in \{0,1\}^{n}$, $Pr[H=x] \leq \frac{1}{2^n\sigma}$. The following is my desperate tries to understand the notion. if $H$ is uniform ...
I encountered the following optimization problem. Let $ S = \lbrace 1, 2, \ldots, n \rbrace $ be a set of items. Each item $ i \in S $ has a non-negative benefit $ b_i \in \mathbb R^+ $, non-negative weight $ w_i \in \mathbb R^+ $ and a non-negative cost $ c_i \in R^+ $. The objective is to select $ A \subseteq S $ tha...
I have a compiler optimization which should be quite common, but I can not find a name for it, nor a reference that describes it. Given an integer x, not known at optimization time, a known constant c and the following program x_1 = x * c x_2 = x_1 / c print(x_2) It's pretty clear that the code can be optimized to pr...
In the answer to this question, I'm not understanding how the string is derived for a given $l$. For example, Case 1: $vx = a^i$ where $i > 0$. Choose $l = 2$ to get $a^{n+i} b^{n+1} c^{n+1} d^n \notin L$. Why is $l = 2$ chosen and how is $a^{n+i}b^{n+1}c^{n+1}d^n$ derived from $l = 2$? Also, how can $vx$ be chosen i...
Given an undirected graph $G = (V,E)$, what is the clique number $\omega(G)$ given $|E|$, i.e., the size of the largest clique in a graph with $|E|$ edges. I think this is doable after realizing that the number of edges in a clique is equal to the triangular number: $$|E(K_k)| = \frac{1}{2}k(k-1).$$ I am looking for a ...
I try to get the intuition behind the notion of strong one way function and weak one way function by reading the scribe One-Way Functions. Particularly, I am interested in examples and definitions of the weak and strong one way function. I known it's very broad notion, therefore I will be as specific as possible in my ...
I get values $x_t$ in an online fashion and want to buy "good" ones, where "good" means that some measure $P(x_t) >T$. Consider the following simple algorithm. T = 0.7 N = 100 // or any value N > B B = 20 // or any value 1 < B < N l = 0 for t from 1 to N: input a new observation x_t let P(x_t) the probability...
How would you explain why the Fast Fourier Transform is faster than the Discrete Fourier Transform, if you had to give a presentation about it for the general (non-mathematical) public?
I am trying to understand FFT algorithm explained here FFT(x) { n=length(x); if (n==1) return x; m = n/2; X = (x_{2j})_{j=0}^{m-1}; Y = (x_{2j+1})_{j=0}^{m-1}; X = FFT(X); Y = FFT(Y); U = (X_{k mod m})_{k=0}^{n-1}; V = (g^{-k}Y_{k mod m})_{k=0}^{n-1}; return U+V; } The author says that the...
I encountered the brainfuck programming language which I know is turing complete. However I then decided to create a high level language that gets compiled to brainfuck code. There is only one data type in it (integer, since that's the only data type brainfuck supports). It supports functions and subroutines (to which ...
One topic I've recently looked at is co-occurence networks formed from Twitter tweets. This is how I felt after looking at the tweets of random people: This leads me to the question: Question: Is it possible to discern the quality of web data from networks derived from it? A hypothetical situation: Suppose we have ...
Cormen talks briefly about the advantages of picking a random pivot in quicksort. However as pointed out here(4th to the last paragraph): Using a random number generator to choose the positions is relatively expensive So how is picking a random pivot actually implemented in practice, and how random is it? It can'...
I got stuck on this question while studying for final exam. I thought about reducing L' to L to prove that L' is recognizable since L is recognizable. I am not 100% sure if that is correct.
I read a quotation attributed to Sheila Greibach that says that the intersection of two context free grammars is recursively enumerable. I could not, however, find a citation for this quotation (and searching has failed to turn up a restatement of this result somewhere else). Can anyone provide a proof or a citation to...
Why isn't the set $\{ \langle i, j \rangle \mid W_i = \overline W_j\}$ a r.e. set? Note: $W_x = L(M_x)$
In a directed graph, the indegree of a node is the number of incoming edges and the outdegree is the number of outgoing edges. Show that the following problem is NP-complete. Given an undirected graph G and a designated subset C of G’s nodes, is it possible to convert G to a directed graph by assigning directions to ea...
I'm looking for a good book that explains these subjects in a readable way. Any suggestions ? I currently pursuing my BSC in computer science, and I just failed to pass the course introduction to thr theory of computation and complexity. I would like to have more reference and sources of knowledge so I can understand t...
Meeting rooms on university campuses may or may not contain coffee machines. We would like to ensure that every meeting room either has a coffee machine or is close enough to a meeting room that does have a coffee machine. (For any two meeting rooms, the architect has told us whether or not they are close enough...
In the set cover problem we want to find in the $\mathbb{S} \subset 2^\mathbb{U}$ the subset $\{s_i\}_{1..k}$, such that $\cup s_i = \mathbb{U}$ for given $K$, where $k \le K$. But how to reduce the set cover problem to the set covering decision problem (determining whether is there such cover or not)? The same with pr...
Is the language $L = \{ a^ib^j \mid i\ \nmid\ j \ \} $ context free ? If we fix $n \in N$ then we know that the language $L = \{ a^ib^j \mid \ \forall \ 1 \le k \le n \ , \ \ j\neq ki \} $ is context free (as it can be presented as a finite union of context free languages in a similar way to the example here: Is $L= \...
Studying parallel algorithms for CLRS, old edition Chapter 30. Can some one explain with a simple example what is pointer jumping and how exactly it works ?
A set is sparse if it contains polynomially bounded number of strings of any given string length $n$ otherwise it is dense. All known NP-complete sets are dense. It was proven that P=NP if and only if there is a sparse NP-complete set (under Karp reduction). I would like to find the density of uniquely satisfiable 3SAT...
A few definitions.. $$ \begin{align*} \mathrm{ALL}_{\mathrm{TM}} &= \Bigl\{\langle M \rangle \,\Big|\, \text{$M$ a Turing Machine over $\{0,1\}^{*}$},\;\; L(M) = \{0,1\}^{*} \Bigr\} \\[2ex] \overline{\mathrm{ALL}}_{\mathrm{TM}} &= \Bigl\{\langle M \rangle \,\Big|\, \text{$M$ a Turing Machine over $\{0,1\}^{*}$},\;\; ...
Edit: My original question referred to nonconstructive and constructive definitions of function types. I changed the terminology in the question and the title to semantic and syntactic, which the answer indicates is the correct terminology for this distinction. I can recall two ways of defining functions in set theory...
What are the steps to perform bottom-up heap construction on a short sequence, like 1, 6, 7, 2, 4? At this link there are instructions on how to do for a list of size 15, but I can't [necessarily] apply the same process to a list of 5 items (my trouble is that 5 is not enough to provide a complete tree).
The yin yang puzzle was written in Scheme. Since it uses call/cc, it is not possible to express it in a pure lambda expression, unless we do a CPS transform. However, given the fact that $\lambda \mu$-calculus have the power to model call/cc, is it possible to write an equivalent $\lambda \mu$-expression? I am still le...
Suppose we are given $n$ distinct integers $a_1, a_2, \dots, a_n$, such that $0 \le a_i \le kn$ for some constant $k \gt 0$, and for all $i$. We are interested in finding the counts of all the possible pairwise sums $S_{ij} = a_i + a_j$. ($i = j$ is allowed). One algorithm is to construct the polynomial $P(x) = \sum_{j...
I wonder what's the time complexity of the following selection problem I found while thinking of a string-matching problem. [Assuming operations on integers take $O(1)$ time] We are Given $m$ sets, with $n$ integer numbers each. We want to select exactly one integer from each set, to make a set S, such that $~ l = \max...
Parallel computing is not new but it is becoming common now a days. This is essentially driven by the need of the users (they need to process more data now) and also because of physical limitations on chip designing e.g power dissipation limits forcing to manufacturers to move to multicore CPUs. My question is how is t...
This problem is about finding a route on a square grid. The starting point is $(1,1)$ and the target point $(n,m)$. I can move each step from my current point $(x,y)$ either to $(x+y,y)$ or $(x,y+x)$. Now I need to determine if there is a path from $(1,1)$ to $(n,m)$, and if so to return the shortest one. Now I believe...
First of all, let me preface by saying that this question is not completly new but the original question hasn't been answered. More important, this is only basic question on understanding the proof itself. So after some search in the site I found the following question : Bellman-Ford algorthm and negative cycle proof. ...
Consider such a rule in grammar for an LR-family parsing generator (e.g YACC, BISON, etc.): Nonterminal : [ lookahead not in {Terminal1, ..., TerminalN} ] Rule ; It's an ordinary rule, except that it has a restriction: a phrase produced with this rule cannot begin with Terminal1, ..., TerminalN. (Surely, this rule can ...
Prove that if G is an undirected connected graph, then each of its edges is either in the depth-first search tree or is a back edge. Now, from intuition and in class lectures by Steven Skiena, I know that the above holds true, since it dives all the way down, and then throw a rope back to a previous vertex. I also know...
I have the following CFG, $S \rightarrow CB$ $C \rightarrow aCa \text{ }|\text{ } bCb \text{ }|\text{ } \text{#}B$ $B \rightarrow AB \text{ }|\text{ } \varepsilon$ $A \rightarrow a\text{ }|\text{ }b$ This is the CFG for the following language: $$L= \left\{w \text{#} x\mid w^R \text{ is a substring of }\ x \text{, where...
Pebbling is a solitaire game played on an undirected graph $G$ , where each vertex has zero or more pebbles. A single pebbling move consists of removing two pebbles from a vertex $v$ and adding one pebble to an arbitrary neighbor of $v$ . (Obviously, the vertex v must have at least two pebbles before the move....
I am trying to solve a system of inequalities in the following form: $\ x_i - x_j \leq w $ I know these inequalities can be solved using Bellman-Ford algorithm. But there is also another condition. I want to find the solution that maximizes $\ x_n - x_1$ As far as I know the default Bellman-Ford algorithm minimizes it....
I'm starting an undergraduate computer science course next fall, but I can't really understand λ-calculus in the context of functional programming. I may be misinterpreting this completely, but based on this definition from the Stanford Encyclopedia of Philosophy, it's just another notation for functions. If it is just...
Let's say I have a decision problem $P$ on graphs for which I know that it is NP-hard on graphs with maximum degree $d$. Does this then imply that it is NP-hard on $d$-regular graphs? Although it might seem obviously true, maybe it is inherent in the reduction to show that $P$ is hard, that some vertices have degree l...
There are two quicksort partition methods mentioned in Cormen: (the argument A is the array, and [p, r] is the range, inclusive, to perform the partition on. The returned value is the index to the pivot after the partition.) Hoare-Partition(A, p, r) x = A[p] i = p - 1 j = r + 1 while true repeat j = j - 1 ...
Sometimes the terms 'Fourier domain', 'complex frequency domain', 'Frequency domain' and 's domain' are used interchangeably. Take these answers here for example. Can you really use them interchangeably all the time, without being technically wrong? So, could you describe what would be wrong if I would replace 's domai...