instruction
stringlengths
35
29.1k
R-complete, i.e. it is an analogue to all recursive language can be reduced to that problem and also recursive? Or is there a really such definition? RE-complete is described on wikipedia. But what kind of reductions is used? Since we are already out of the set R, does it still make sense to define by many-one reductio...
If it is possible to construct an SLR parse table with no conflicts for a particular grammar does that mean that the grammar is unambiguous? I think that since we have constructed the parse table which means for every sentence we would be able to decide whether the string will be accepted or not. But I am a little bit...
As I understand it the Quine-McCluskey method allows you to start with a set of maxterms (or minterms), and combine them pairwise in a systematic way into a smaller set of clauses with a smaller set of variables in some (hopefully most) of the clauses. I understand how to apply the method, given a set of maxterms. My...
I will briefly state the context where my doubts arise. I know the following definitions. A formal language is a set of well-formed formulas. It's a tuple constituited by an alphabet and a formal grammar. An alphabet of a formal language is a set of symbols. It's usually consituited by letters (symbols whose inter...
I have the following problem: There are existing stars (as in graph-theory stars) with a fixed representation in a 2D coordinate space, meaning that angles between the edges are not allowed to change. Now I want to add additional edges from the star center. Both the amount of existing edges and the amount of edges to a...
I don't know why case 4 will resolve the issue of the double black of $x$ described in Introduction to algorithm p.329. I know case 1 is transformed into one of {2,3,4} case, and case 2 re-point $x$ to its parent node so it's approaching the root, and case 3 will be transformed into case 4, but both case {3,4} will not...
Suppose you and your $k - 1$ housemates decide to throw a party. Each housemate $i$ gives you a list $P_i$ of people she would like to have invited to the party. Depending on how much you like housemate $i$, you pick an integer $m_i$ indicating the minimum number of people on $i$'s list that you'll invite. Having sel...
Is it not always possible to represent a Finite State Machine (FSM) by a Boolean dynamical system? A Boolean dynamical system is defined by a Boolean map $F\colon B_{0}^n\to B_{0}^n$ (where $B_{0}$ is the-two element Boolean algebra $\{0,1\}$ with operations of $\lor$ (OR), $\land$ (AND) and $\neg$ (NOT)) as $$x(k+1)=F...
I have a question to the reduction from Vertex Cover into Dominating Set. So my lecture says if I have a undirected Graph $G = (V,E)$ where $S \subseteq V$ is a vertex cover. Then we construct a new graph $G'$ which has the same vertices of G, except the isolated ones. For each edge $\{u,v\}$ in $G$, we add a new verte...
Summary: I am struggling with the Pseudo code for an that algorithm assigns "least filled slot first" to a tasks on multi-core chip. Detail So far I have written following: What I do not like here is: In while loop I am removing one by one elements of $R$ (which is a row vector with $m$ elements). This means the co...
The successive shortest path algorithm, used to solve the minimum-cost flow problem, can be described as follows : Successive shortest path (for minimum-cost flow) : while all flow is not sent : compute shortest path between source and sink nodes w.r.t. arc costs (through Dijkstra's algorithm for example). augment t...
Suppose i have some NPDA and there is some transition functions defined as: $\delta(q_{1},a,A) = (q_{2}, A)$ $\delta(q_{1},a,A) = (q_{3}, Z)$ Is it allowed? I understand, that since the NPDA is nondetermenistic, it's possible to have transitions to different states with the same input character, but what about same ele...
Let's say I want to set x1=1 if (x2=1 AND x3=1 AND x4=1) or (x5=1 and x6=1) or (x7=1) else x1=0 All of the xs are binary variables. My first thought is I have to add 3 additional variables, let's say y1, y2, y3 and 12 constraints like this 3*y1-x2-x3-x4<=0 y1-x2>=0 y1-x3>=0 y1-x4>=0 2*y2-x5-x6<=0 y2-x5>=0 y2-x6>=0 y3-...
I am working on an implementation of inverse kinematics using the jacobian transpose method. The implementation seems to be working as it does find the "theta" vector, although sometimes it might take an insane amount of steps to do so, which makes me believe that it is not correctly implemented. So after reading a bit...
Master's Theorem is known to me, but I can't understand how to apply this theorem to this problem. So, how I will find Θ of T(n)?
I mean that for every $i$ from 2 to $\lceil \log_2n\rceil$ I want to know $\lfloor \sqrt[i]{n}\rfloor$. Could this be done faster than computing the roots one by one?
I am new in algorithm and studied about some problems in algorithm related to graph theory. These problems we can transform to some polynomials and if for each set of polynomials related to a problem we have a solution then it means the problem has a question. For example we can transform the problem of MAx-Clique to t...
Given to us is an array $B[1],\ldots,B[n]$ as input, which satisfies the following property: there exists a special index $i^* ∈ \{1, \dots , n\}$ such that $$B[1] < B[2] < \dots < B[i^*− 1] < B[i^*] > B[i^* + 1] > B[i^* + 2] > \dots > B[n].$$ It is noted that the index $i^*$ is not given as part of the input. The ques...
I want to train a Perceptron using stochastic gradient rulefrom the stream data. I have very limited amount of memory and i can store only $N$ examples. Suppose my population consist of point as show in the following picture: Now suppose my first $N$ examples come in following fashion and i can classify them correctl...
I have a question regarding performance of 2-opt and 3-opt algorithms. I tried implementing the 3-opt and 2-opt algorithms and most of the time 3-opt outperforms the 2-opt algorithm around 5%. Surprisingly, in few cases my 2-opt algorithm outperforms the 3-opt algorithm. I am wondering, is it some kind of error or it ...
I have a chain graph like in the picture. Each node of the graph has finite possible labels, i.e. states, which define the node's weight(non-negative) as well as the internode weight(also non-negative). Each node is connected to m previous ones. The internode weight is shown as edge and node weight as node itself. Is t...
Given two CFGs for balanced parentheses. $S \rightarrow SS \mid (S) \mid \epsilon$ $S \rightarrow S(S)S \mid \epsilon$ How do I show that they are equivalent? I have been able to show $ L(2) \subset L(1) $ as follows $$ S \Rightarrow SS \Rightarrow SSSS \leadsto S(S)S $$ Thus, $ S \leadsto S(S)S $. Keeping productio...
Note: this question has been cross-posted to Math.SE, after about a week here. I am trying to deepen my understanding of the relationship between the Halting Problem and Godel's Completeness Theorem (not Incompleteness). Specifically, as I understand it the Completeness Theorem guarantees a finite proof for any first-...
I'm a university student currently taking an Assembly and Computer Organization class. On last weeks lab we were given a question: Suppose that you buy a 32bit PC with 16 MB of Ram. What is the 8-hex-digit address of the last byte of installed memory? From my understanding you multiply MB (2^20) with 16 (2^4) which giv...
The following question on the theory of computation is GATE 2019 CS question 24: For $Σ = \{a, b\}$, let us consider the regular language: $$L = \{x \mid x = a^{2+3k} \text{ or } x = b^{10+12k}, k \geq 0\}$$ Which one of the following can be a pumping length (the constant guaranteed by the pumping lemma) for $L$? (A...
I'm doing a problem where I need to prove that there is a language A ⊆ {0, 1}* with both of the following properties: (i) For all x ∈ A, |x| ≤ 5. (ii) Every DFA that decides A has more than 8 states. To prove this, is it suffice enough to just give an example language A ⊆ {0, 1}* that holds both of these properties?
There's a problem in Kleinberg & Tardos's Algorithm Design (Chapter 6, Question 4) where you are running a lightweight consulting business that has two offices: NYC and SF. In month $i$, you'll incur an operating cost of $N(i)$ if you run the business out of NY; you'll incur an operating cost of $S(i)$ if you run the b...
I'm practicing a problem where I need to prove that every full prefix-free language is maximal. I know a prefix-free language A is maximal if it is not a proper subset of any prefix-free language, where a prefix-free language is full if, $$\sum_{x\in A} 2^{-|x|} = 1$$ Furthermore, I know that a language A ⊆ {0, 1}* is...
I want to iterate through the first $k$ elements of a randomly ordered list containing all subtrees for a given tree. The definition of subtrees that I'm using is: "A subtree of $T$ is a subgraph of $T$ that is also a tree". For example, a tree $A(B(D, E, F), C(G, H))$ should have 62 subtrees if my math is correct. The...
I am a student who is studying machine running alone. As far as I know, the Tf-idf Vectorizer is a function that combines the Count Vectorizer and the Tf-idf Transformer. I was wondering if the Tf-idf Transformer process could actually have a impact on the model learning process. In my experience, there seemed to be no...
Given a directed graph $D = (V,A)$ with edge-weights $w\in\mathbb{R}_{++}^A$ I'm trying to construct the following graph $D'=(V',A')$: For a fixed $v\in V$ we add a vertex $(v,0)$ to $V'$ For every $(z,i)\in V'$ and $zu\in A'$ we add the vertex $(u,i+w_{zu})$ and the arc $(z,i)\to(u,i+w_{zu})$ In each path of $D'$ the...
I am having a hard time even to formulate my question, so here it is: I have an application that the user can go in and define on a webpage the logic one wants to evaluate for the student to comply with: Student must take classes (MATH111 OR (MATH101 AND MATH103)) I have an array of all its enrolled classes like: [...
In a bipartite graph $G = (V,E)$, there is a neat algorithm for finding a maximum matching (or even a maximum-weight matching) using linear programming. It is explained here. The first step is to solve the following LP: $$ \text{maximize}~~\sum_{e\in E} w_e x_e \\ \text{subject to}~~\sum_{e\in E: v\in e}x_e=1\text{ for...
Question 1 Consider a repetition code to detect $m$ errors. What is the smallest repetition parameter $k$ (i.e., the number of repetitions per bit) it should be used so that the code can always detect $m$ errors? To be clear I know that you need $k=2m+1$ to correct errors, I am asking what is $k$ if you only want to de...
I was going through Count All Palindromic Subsequence in a given String where I've to count all the palindromic subsequence of a given string. After seeing the brute force(recursive solution), I went through the dynamic programming technique but the index values used surprised me. for (int L=2; L<=N; L++) { for (...
In Elements of the Theory of Computation by Lewis and Papadimitriou, the authors use a specific function for proving that application of unbounded minimization on a primitive recursive function need not be regular. They choose a peculiar function to prove so, defined as follows. Let $M=\{K,\Sigma,\Delta,s\}$ be a Turin...
I want to define the language of this FSA with a regular expression. I have learned that by state-elimination, I would be able to find a regular expression. But there are already some epsilon transitions in this FSA. My question is: Should I first follow the epsilon-removal construction, and then do state elimination? ...
I recently wrote my Grad school Admission test few days back and the following question appeared in the test. There are 'n' unsorted Arrays : A1, A2, ...., An. Assume that 'n' is odd. Each of A1, A2, ..., An contains 'n' distinct elements. There are no common elements between any two arrays. The worst case time complex...
I am reading Introduction to Algorithm CLRS (3rd ed.), Chapter 4 (Divide and Conquer), page 78, and am not sure why the explanation of why SQUARE-MATRIX-RECURSIVE algorithm takes $Θ(n^3)$. Combining equations (4.15) and (4.16) gives us the recurrence for the running time of SQUARE-MATRIX-MULTIPLY-RECURSIVE: $$ T(n) ...
The theorem states that $$ H(P)\leq\mathrm{MinACL}(P)<H(P)+1 $$ where, $\mathrm{MinACL}$ means the minimum average code word length of a given information source, i.e. the average code word length of any Huffman coding and $H$ means the entropy of the probability distribution $P$. Now, the problem is how to show that f...
$ L = \{ww^{R} \in \{a,b,c\}^{*} : |w|_{a} \not\equiv |w|_{b} $ and $ |w|_{b} \not\equiv |w|_{c} \} $ I would use the Ogden pumping lemma. Assumption $n < m$ where $n$ is a number from lemma. My selected word : $ a ^ {m! + m} c ^ {m! + m} b ^ {m} b ^ {m} c ^ {m! + m} a ^ {m! + m} $ where the first $ b ^ {m} $ are the...
How would one find a minimum-weight perfect 2-matching of a general graph? Is it possible to use standard matching techniques like Blossom V? A minimum-weight perfect 2-matching of a graph G is a subgraph M of minimal total edge weight, such that each vertex in G is incident by exactly 2 edges from M.
To find the meaning of computer architecture terms in Computer Science do I need to use a Computer Science book? Do I need to find the computer architecture terms in a Computer Science Dictionary or is there a another way of finding the computer architecture terms? If there is another way to find the terms please can y...
It is known that every program or every algorithm can be converted to Turing machine. But what about the reverse process? Is there algorithm (or research trend that considers such algorithm) to convert some Turing machine into algorithm as expressed in some high level programming language (e.g. in Algol, Java, Prolog, ...
How would one find a minimum-weight perfect b-matching of a general graph, where the number of edges incident on each vertex is a positive even number not greater than b? A minimum-weight perfect b-matching of a graph G is a subgraph M of minimal total edge weight, such that each vertex in G is incident by exactly b ed...
I'm struggling to think of such a network. According to the definition I'm working with: Given a network $(V, A, w)$. For all arcs $(u, v) \in A$ : $\quad$ If $d[u, |V| - 1] + w(u, v) < d[v, |V| - 1]$: $\quad\quad$ Print “Negative cycle!” and stop immediately To me this implies the only way a negative cycle isn't det...
According to this link: We need the notation for the lower bound. A capital omega $\Omega$ notation is used in this case. We say that $f(n) = \Omega(g(n))$ when there exist constant $c$ that $f(n) \geq c \cdot g(n)$ for for all sufficiently large $n$. Examples: $n = \Omega(1)$ $n^2 = \Omega(n)$ $n^2 = \Omega(n \cdot ...
Can't find a good way to tackle the problem. Would appreciate any help. $A$ is an $n$ items array from an ordered set, in which every item is at most $\log n $ indices away from its position in the sorted array. Show that: The array can be sorted in $O(n\log\log n)$. There is a lower bound of $\Omega(n\log\log n)$ f...
$ L = \{w \in\{a,b\}^{*} : \exists_{x,y,z} , w=xyyz \wedge y \neq \epsilon \}$ I have a problem with this exercise. I need to determine if this language is regular, context-free or not both and prove. The word itself $ww$ above the alphabet $a, b$ is not context-free, but here we have $(a + b) ^ {*}$ before and af...
I was wondering about the following interesting questions: Polynomial multiplication can be done in $O(nlog(n))$ using FFT where n is the degree of the polynomial. What about finding a specific coefficient (or even deciding whether it is 0 or not) of some degree $k$ of the multiplication of an input? It is trivial to s...
Consider this example on binary trees in some ML-like language: type tree = | Null | Node of tree * tree let rotate_left p = match p with | Null -> p | Node (a, q) -> match q with | Null -> p | Node (b, c) -> Node (Node (a, b), c) In the definition of rotate_left above I only want to consi...
$ L = \{ww^{R} \in \{a, b\}^{*} : |w|_{a} \equiv |w|_{b} \equiv 0$ $ (mod$ $13) \} $ Exercises: If the language L is regular (build a DFA or regular expression) else if the language L is context-free (build a grammar or PDA) else if the language L is not context-free (Prove) so We know that $ww ^ {R}$ without any re...
I am learning Big O and Big theta notation and confused the certain case. I have two functions, function 1(f1) $$ n * n^{1/2} $$ function 2(f2) $$ 1.001^n $$ in smaller cases (10,000) f1 is much faster than f2, however, it is vice versa for bigger case (10,000,000). For the smaller case, I can say $$ f2 = O(f1) $$ In t...
You are given a 2d grid where each grid item has a value of 1 or 0, you can only move horizontally or vertically and if both blocks have value of 1. You are also given a starting index, the output should have the "connected" grid items property to true. For example: input = [ [{value: 0}, {value: 1}, {value: 1}], [...
If $L\subseteq\Sigma^*$ is a regular language, then $\text{mir}(L) = \{ww^R \mid w\in L\}$ is context-free. This is a nice exercise. Question: does the reverse hold? Thus, if $\text{mir}(L)$ is context-free, do we always have $L$ is regular?
I'm having trouble making an algorithm to fit these specs: Given a complete binary tree ($n = 2^d$ leaves) with integers in leaves. Reading the leaves from left to right makes a sequence of integers (we can assume we have an array) Goal: How can we minimize the number of inversions in that array only by choosing non-...
$L = \{ w : |w|_{a} \equiv |w|_{b} \vee |w|_{c} \equiv |w|_{d} \}$ In my opinion complement of the L language is $L^{C} = \{ w : |w|_{a} \neq |w|_{b} \wedge |w|_{c} \neq |w|_{d} \}$ I choose to Ogden pummping lemma word $s = a^{p}b^{p + p!}c^{p}d^{p + p!}$ and $ p > n$ I would like to distinguish $c ^ {p}$. And then...
I am trying to prove the following Knapsack approximation algorithm, the problem definition: Input: A set $S$ of $n$ objects that contains weights and values: $w_1,w_2,\ldots,w_n$ (weights) $v_1,v_2,\ldots,v_n$ (values) $W$ — The total weight bound. Scaling factor $0 < c < 1$ Output: Let set $\mathrm{OPT}(...
Feynman's Computer Heuristics lecture was apparently given at the Esalen Institute, Big Sur, California, in 1985. But I have no formal evidence of this. Has anyone ever cited this lecture that you can point out?
The Church-Turing is a hypothesis about the nature of computable functions. It states that a function on the natural numbers is computable by a human being following an algorithm, ignoring resource limitations, if and only if it is computable by a Turing machine. In wikipedia (https://en.wikipedia.org/wiki/Church%E2%80...
Consider a variation of the normal heap which we will call the x-heap The x-heap of height $h$ has the following properties: It will have $2^h$ nodes A height of $0$ corresponds to the single root node The format of the tree is a root with exactly one child, which in turn is the root of a complete binary tree We def...
Me and a friend were discussing how programming languages can perform asynchronous tasks, like waiting 15 seconds before performing another task, and we started a debate. I know that computers have an internal clock that uses the CMOS battery that can keep track of time, but how does it know it has been 15 seconds sinc...
I am currently in the process of proving some complexity bounds about k-DNF. However I am confused what the $n$ in the time complexity would refer to in this case (that is that I don't know how the "size" of a k-DNF is defined, nor was it defined in the assignment). Is it the number of clauses, the number of literals (...
Let us consider Martin-Löf type theory with a cumulative hierarchy of universes $$ \mathcal{U}_0\colon\mathcal{U}_1\colon\ldots $$ If $A, B\colon \mathcal{U}_i$, we can form an identity type $A=_{\mathcal{U}_i} B:\mathcal{U}_i$. Using the axiom of cumulative hierarchy, we can derive $A, B:\mathcal{U}_{i+1}$, so we have...
I am following Bottom up chart parsing algorithm from Natural Language Understanding book by James Allen. It is I couldn't understand the 3rd step. I thought that when active arc is added the dot is advanced. But dot is indroduced in the third step. The example says that This example shows dot is advanced. But step...
Here is problem in Sprinklr Interview Experience | Set 5 (On campus – FTE for Product Engineer). You are given a graph of $n$ nodes with $m$ bidirectional edges. Each edge has some value associated with it. Vertex $1$ is source vertex. You have $K$ wildcards. In the path from vertex $1$ to vertex $i$ ($2 \leq i \leq n...
It just occurred to me that things like "greater than or equal to" and other "logical operators" are also just simple functions, such as gte(a, b) == a >= b. This makes me wonder why these are treated as "special" in databases and why they are not just functions like SQL functions. Wondering if there is some advantage ...
What I am trying to do is for a diet app that I am planning to build. The goal is the users will input their desired macros (carbs, fat, protein) and the system should find all recipes that match the provided macros. It does not have to match it exactly, just the best match. Another idea is users provide their daily ca...
I use Meshroom (based on the framework AliceVision) to reconstruct a scene based on photographs (e.g. a bottle on a table in a room). The software captures the bottle, but also the table and the whole room, so I have a huge model in the end. I also a have a ground truth model of the bottle. My goal is to align the whol...
I'm having a hard time trying to understand how to solve this recurrence relation using the Master Method: $$T(n) = 10T\Big(\frac{n}{2}\Big) + \frac{n^4}{\log(n)}$$ First, we have: $a = 10,\ b = 2$ so we have $n^{\log_2^{10}} = n^{\lg10}$ Now we need to find how $f(n)$ compares to $n^{\lg10}$. And here I'm stuck. What ...
I am trying to implement "Contraction Hierarchies" algorithm and reading the white paper and watching video lectures [6,7]. But still I can't understand proof for the following lemma: Lemma 1. $d(s, t) = min(d(s, v) + d(v, t) : v $ is settled in both searches $)$. Proof. We only give a proof outline for self-contained...
$$ \delta(q,a) = \begin{cases} \delta_1(q,a) & q \notin F_1 \text{ or } a \neq \lambda \\ \delta_1(q,a) \cup \{q_1\} & q \in F_1 \text{ and } a = \lambda. \end{cases} $$ Look at the second line of the function definition. It's a transition function. $q_1$ is the starting state. What does that union mean here? Union of ...
To show that problem is NP-hard, we take a known NP-hard problem and reduce it to the problem whose NP-hardness we want to prove. The reduction we need is polynomial time reduction. But If I take known NP-hard problem and reduce it to some unknown problem by Turing reduction then what I can say about the unknown probl...
I'm studying AVL Trees in my programming class and we got this exercise dealing with right, left, left-right and right-left rotations as a way to check if we understand the theoretical concept of AVL Trees. We're given the numbers $100,50,25,10,37,32,200$. Creating an AVL Tree until $37$ wasn't that difficult but then ...
$ L = \{xyyz\in\{0,1,2\}^{*} : y \neq \epsilon \wedge \exists_{a \in \{0,1,2\}} |y|_a \equiv 0 \}$ I think this languages is regular. I write regular expression: $(1 + 2 + 0) ^ {*} (11 + 22 + 1212 + 2121) (1 + 2 + 0) ^ {*} \cup (1 + 2 + 0) ^ {*} (11 + 00+ 1010 + 0101) (1 + 2 + 0) ^ {*} \cup (1 + 2 + 0) ^ {...
Let $A$ a $n\times n$ matrix, and X the full matrix of $n\times 2^n$ binary vectors (you can choose the order of the columns of X). What is the fastest way to compute the product AX?
Even though grammars can do what regular expressions do, why are regular expression employed instead of grammars in lexical analysis?
In Chapter 23 of CLRS, the following quote appears: We also assume a limit on the size of each word of data. For example, when working with inputs of size $n$, we typically assume that integers are represented by $c \lg n$ bits, for some constant $c ≥ 1$. Here is how I understand the text: I searched on the Intern...
So there are One Instruction Set Computers, having only one (complicated) instruction like addleq, "add and branch if less than or equal to zero". And then there are extremely complicated Instruction Set Architectures (ISAs) with 100's of instructions like x86. Most computers today I think use the x86 architecture, tho...
Given set of points (in the plane), find in a linear time the smallest width annulus (annulus is the region between two concentric circles) that contains all the points. Because of the time constraint we can't use any type sort/tree, also I've tried to think about using selection algorithm, but I can't think of a way t...
I am having difficulty writing this formally. I know that by L'Hospital's rule we can reduce it to $\lim_{n \to \infty} \frac{n+1}{n}$ which is a constant and hence $n = \theta (n+1)!$. But I am not sure how to write this formally.
My study group and I have had some back and forth on one exercise and I haven't found any matching solution online. The task looks as follows: Prove that $L$ is not regular given $$ L = \{ a^k b a^{m-1} \mid k,m \in \mathbb{N} \} $$ Questions: How does $m-1$ affect my choice of the word to be pumped? There must be a w...
In the textbook Introduction to Algorithm, third edition, by Coremen et al. (CLRS), the following introduction has been given about divide and conquer algorithm strategy In divide and conquer, we solve a problem recursively, applying three steps at each level of recursion: Divide the problem into a number of subprob...
CPU's are to an extent designed with in mind the software that people will write for it, implicitly or explicitly. It seems to me that if you look at the design of instruction set architectures, they are very "imperative", in the sense that each instruction encodes an imperative style command. It also seems to me that...
Given a 2-dimensional maze where you can give 4 commands "move up/down/right/left". Knowing the maze but not where the person is, how to find the minimum sequence of commands that guarantees exiting the maze? I'm looking for a single sequence of commands that will work no matter where in the maze you start from. Assum...
Let us write $\{ A_1, \ldots, A_k\} \rightrightarrows^n \{B_1, \ldots, B_m\}$ for a relation $R$ if for all $\langle a_1, \ldots, a_k\rangle$ we have $\left\lvert \pi_{B_1, \ldots, B_m} \sigma_{\bigwedge_{i = 1}^k A_i = a_i} R\right\rvert \le n$ (and $A_i$, $B_j$ are attributes from the schema of $R$), i.e, for any cho...
I was searching for a difference on both ways of proving that a language is not regular but I didn't came up with much. Let us take the following as an example: $$ L = \{ a^n b^n \mid n \ge 0\} $$ Could someone tell me the differences between both theories and how to prove the language I brought is not regular accordin...
What data structure has the best asymptotic running time for nearest-neighbor search on multidimensional data? I am interested in both preprocessing time and query time, but let's restrict attention to data structures with logarithmic average query time; how low can we make the average preprocessing time? By average,...
Consider a Directed Acyclic Graph in which every node has a value and a cost and edges do not have any weight. I need to find a path containing nodes such that sum of values of these nodes is maximized, but sum of cost over all these nodes must be at most C. I am thinking of some modification of Dijkstra's algorithm. A...
I know about the concept of the "model" of a logical proposition in the context of mathematical logic: It is a mathematical structure in which that proposition is true. However, it's not clear to me what a "model" of lambda calculus is. Wikipedia states the following: To formulate such a denotational semantics, one mi...
Let's define a replace query on some string $s$. Consider a string $s$ of length $n$ over alphabet $C = \{ c_{0}, c_{1}, c_{2}, \dots, c_{k}\}$. Also consider $l, r \in \{0, 1, 2, \dots, n - 1\}, l \geq r; \quad c_{i}, c_{j} \in C$. The replace query $\left(l, r, c_{i}, c_{j}\right)$ replaces all occurrences of $c_{i}...
I assume the reason space makes a difference in F# is due to reserving a certain function, when minus is in front of a number without space, however what are the reasons for this? I can't seem to find any functions related to this
$L = \{x \in(a,b,c,d)^* \mid -10 \leq ( |x|_a + |x|_b) - ( |x|_c + |x|_d) \leq 10 \}$ I don't have any idea. Can someone help me.
$L = \{y \in (a+b)^* \mid ||y|_a - |y|_b| \leq 10 \}$ Any idea? I have problem with this kind of task.
I'm looking at the following question from this handout: The class of decidable languages is closed under union My question is, does this hold in reverse? Is there a phrase for this? Basically, if $L_1 ∪ L_2$ is decidable would $L_1$ and $L_2$ be decidable as well? I believe it does, by making one machine $M$ to emul...
Disclaimer. What I'm going to ask about below may seem to be "Topological sorting". To my understanding, it is not. The latter runs in linear time, while I'm looking for a modification of the regular sort, which is at $N\log N$. Remark. I'm doing the sort in the reverse order, to use the analogy with heights and masses...
The letters $\mu$ and $\lambda$ are usually used to represent, respectively, the length of the tail of the graph and length of the cycle in the graph. But Menezes on note 3.8, page 91 (or PDF-page 6), seems to have swapped their roles. $\mu$ and $\lambda$ in Floyd's cycle detection algorithm"> There's nothing wrong wi...
for (i = 2; i < n; i = i * i) { for (j = 1; j < i / 2; j = j + 1) { sum = sum + 1; } } I know that the outer loop can run for a maximum of $n^2$ times and the inner loop will run for $\frac{n^2}{4}$ times.
I have this problem A firm has $q_j$ jobs of type $j$, where $1 \leq j \leq n$. It also has $[n] = {1,2,...n}$ machines. Machine $i$ can service any job of type $j$ where $j ≤ i$. The cost of running machine $i$ is $f_i +m_i·q$ where $f_i$ is the fixed cost of running the machine and $m_i$ is the marginal cost of servi...
So I'm aware that the singleton language is in fact regular for all x ∈ Σ*, but I do not understand why it is. A formal proof would help, but also getting some intuition as to why it is regular would also be appreciated! As of now I'm just aware of it as a property, but I don't have a good grasp on why it is regular.