instruction
stringlengths
35
29.1k
I have a proof that I need help with. Like the title says, the theorem is that every bit-reversal ring is $\frac{1}{2}$-symmetric. The theorem is for Leader Election algorithm in synchronous ring. The things I know follow: Bit reversal ring is defined as follows: We assign to each process $i$ the integer from ${0,\ldot...
In Coq, while trying to prove a lemma mult_n_Sm for mult_comm, I have this equation in a proof: S n * S m = S n * m + S n (* simpl. *) S (m + n * S m) = m + n * m + S n Lets look at right hand side of the equation. S n * m + S n was simplified into m + n*m + S n.( by definition of nat, S n = n + 1, hence (n+1)*m ...
I have a complete undirected graph $G=(V,E)$ with positive non-null rational weights $c:E \to \mathbb{Q}^+_{*}$ on the edges, such that $c(v,v) = 0$ for all $v$, and a subset $C \subset V$. I would like to find (if it exists) a subset $S \subset V$ such that $\delta(S) < 2$, $S$ contains at least one vertex of $C$, and...
First of all I'm a Physics Student and I've been arguing with my brother concerning the usage and the fundamental meaning of a vector on Computer Science (CS). I) Vectors A vector have a axiomatic meaning, i.e., given a set $\mathcal{A}$ of objects, their objects can be called vectors if and only if they satisfy the ve...
Having trouble figuring out a NFA for the following language, the objective is to use only 3 states: $L = {\{1^ky : y \in \{0,1\}^* }\text{ and y contains atleast k 1's, for k} \ge 1 \}$ I have got to as far as the NFA below, which would only work if the y contains clause wasn't included: So I need a different approac...
Given a collection of non-empty intervals [a,b), where a/b are integers in some finite range (ex. 0...100) and a is less than b, can you find an algorithm that will detect all intervals that exhibit some collision/overlap where the worst-case performance of the algorithm is better than O(n^2)? You can assume that inter...
I am trying to construct a nfa that generalizes Example 1.33 found in the book Introduction to the Theory of Computation by Sipser, but I am quite sure that my transition function is wrong. I'd like some advice on how to fix that and how to simplify the notation such that to make it simpler. Let $k > 0$ be a natural nu...
I was reading about possible solutions to the well known problem: Given array A with length N create a structure that enables Answering what is the sum $\sum_{k=i}^{j} A[k]$ Updating $A[k]$ I've seen most solutions use binary index tree but was curios whether it's possible to just use a regular tree that is built u...
Suppose the following situation. You have a decision problem $D$. You know that $SAT$ is $NP$-complete. You know that $D\leq_p SAT$. Can you conclude that $D\in NP$? I think it's true because it means that $D$ is at least as hard as any other problem in $NP$. As I know I am not able to post questions to answer with y...
In the book, Data Structures Algorithms in Java Sixth Edition by Goodrich, Tamassia, and Goldwasser on page 339, there is an "Example of a heap storing 13 entries with integer keys. The last position is the one storing entry (13,W)." I've recreated the a similar image using qtree-tikz with my own depth and height cal...
Consider a sphere with a coordinate system like the earth. There are $N$ points on its surface at random positions. For all the infinite planes that cuts the sphere exactly in half (i.e. the sphere's center is on the plane), given the set of $(latitude, longitude)$ of the points, find the global maximum number of point...
I am looking for an algorithm that checks if the Levenshtein distance between two strings $s_1$ and $s_2$ is less than a certain upper bound $B$. I know, there are plenty of algorithms for calculating the Levenshtein distance, but I expect a possible efficiency gain in scenarios where $B$ << $Levenshtein(s_1, s_2)$, be...
Why are data transfer speeds faster with EIDE than IDE? Wouldn't it be slower with the additional conversion of logical block addressing? What did they change to make it faster?
I thought about implementing a data structure with expected runtime of O(1) for insertion, deletion and look-up and a worst case runtime for these operations of O(log(n)). This is under the assumption of uniformly distributed data. What I thought of was a simple hash table using BST for the collisions. Does that make s...
I've already proven the statement using the limit definition of $o(g(n))$ and Stirling's approximation, but how do I prove it using the main definition for $o$ notation provided in CLRS instead? Definition: $f(n) = o(g(n))$ if for all $c > 0$ there is $n_0 > 0$ such that $0 \leq f(n) < cg(n)$ for all $n > n_0$. I've tr...
Consider an undirected and unweighted graph with $n=|V|$ nodes and $m=|E|$ edges stored in adjacency matrix format. What is the time complexity of finding the highest-degree vertex, assuming the vertices are given to you in no particular order? The answer is $ \mathcal{O}(n^2) $ but I don't know how to get there. I div...
I’m programming web application which has some tricky calculations and I would need some help with mathematical calculations. What I'm trying to calculate: I have number of items. Lets call items a1, a2, ..., an. Each item consists of three components (let's call them x, y and z). Components have a ratio which is perce...
Imagine you have a number x, when x ∈ [0, N]. Is there any algorithm that can map x to y, so that y is also y ∈ [0, N] with the mapping being unique, and the distribution of all y is distributed pseudorandomly across the whole range? I know it's possible by just generating a set from 0 to N, shuffling it, and using x a...
Hello I am a new Computer Science student Ok, so I am trying to sort the 2D array I know you can actually sort a 2D array by copying it into a 1D array sort it using any Algorithm, and then place back into the 2D array but here is the problem aren't we using more space and time because we have to copy the array back. ...
I know that the below program uses Reversal algorithm to rotate an array's elements to k positions to the right. But how does the Reversal algorithm works? It seems kinda magic to see. Can somebody give me the intuition or simple math explanation for me to understand. void rotate(vector<int>& nums, int k) { k %=num...
I am struggling with trying to come up with the inductive proofs to prove that the following grammar is equal to $ L = \{0^m1^n | m \leq 2n, n \leq 2m \}$ The grammar is $ S → A \:|\: B $ $ A → 00A1 \:|\: C $ $ B → 0B11 \:|\: C $ $ C → 0C1 \:|\: ε $ How exactly do the proofs for proving $ L \subseteq L(G) $ differ from...
I will be taking a computational complexity theory course in about a year, and as the reference material will be Computational Complexity A Modern Approach I am more than confident that without a proper preparation that course will eat me alive. The book seems to have excellent practise problems in the sense that it wi...
I have a point location problem (in a planar graph) with a twist: rather then finding which region the point is located in, I would like to find the closest segment (edge) to a point, ideally with a O(log n) complexity. So far I was not successful in finding any reference that would discuss this specific problem. Is th...
I'm having a hard time understanding how left/right derivations work. I have a very simple example that I've attempted but I don't really know how to check if it's correct. $S \to NP$ $V$ $NP$ $NP \to$ the $N$ $N \to$ cat | mouse $V \to$ ate LEFT $S\to NP$ $V$ $NP$ $S\to$ the $N$ $V$ $NP$ $S\to$ the $N$ $V$ the $N$ $S\...
Suppose I have a simplicial $k$-complex $\mathcal S$ whose vertices are embedded in Euclidean space $\mathbb R^n$, for roughly $k< n\leq 6$. Examples include triangle mesh surfaces ($k=2$) embedded in $\mathbb R^3$ ($n=3$) and one-dimensional chains of line segments ($k=1$) in $\mathbb R^n$. Given many points $\{x_i\}_...
I am aware that first-order logics (FOL) satisfies the compactness theorem. That is, if a FOL theory is insatisfiable, a finite subset of the axioms of such theory is insatisfiable too. Is it the case that FOL extended with least-fixed point (LFP) satisfies the compactness theorem too?
Consider a variation of a Queue called MaxQueue, Q, that has the following operations: dequeue(Q): removes and returns the first element of Q enqueue(Q, s): Appends the integer s to the end of Q maximum(Q): returns the largest integer in Q (but does not delete it) The MaxQueue data structure also contains a sequence...
I came across a problem about a cashier scanning goods that I'm stuck on. I paraphrase the question below. A cashier only has x time to scan a person's goods. The goods come 1 item per time step in a conveyor belt. In one time step, the cashier can either scan an item or bag the item (so when bagging, the cashier miss...
The below function converges to a constant as you take n to infinity. $f(n)=(1 + \frac{1}{n})^n$ $\lim \limits_{n \to \infty}(1 + \frac{1}{n})^n = e$ Would this imply that it is O(1) since you can just upper bound it with a constant?
I know, loosely speaking, if we can define a function $f$ in term of \begin{align} &f(0,\vec{x})=g(\vec{x})\\ &f(n+1,\vec{x})=h(f(n),n,\vec{x}) \end{align} where functions $g,h$ are primitive recursive. Then $f$ is primitive recursive. However, what it means to show a function is primitive recursive by induction? I ha...
I am trying to use a classical Kalman filter for getting indoor location. I am using geolocation API of HTML to get latitude, longitude, position accuracy and speed. I am also using the smartphone's accelerometer to get acceleration. The Kalman filter combines this sensor data. I tried making a simulation in python...
I know with absolute certainty that this is the wrong runtime, but I just wanted to show you how I got to it. for (i = 0; i <= n; i++) do j = 2*i while j <= n do j = j + 1 print("Hello World") end Then I get the runtime $Θ(\sum_{i=1}^n 1 + n -2i)=Θ(n+n^2-n(n+1))=Θ(0)$??
I've been struggling with reduction while solving this exercise and I would really appreciate some help if not the solution. Problem: [3-SAT-WITH-MAJORITY] Input: A set of clauses $C = {\{c_1, \dots, c_k}\}$ over $n$ boolean variables $x_1, \dots, x_n$ where every clause contains exactly three literals. Output: YES if ...
I'm reading Arpaci's Operating Systems: Three Easy Pieces, the chapter on Locks. At the end of the chapter, they present Two-phase locks (section 28.16). They say A two-phase lock realizes that spinning can be useful, particularly if the lock is about to be released. So in the first phase, the lock spins for a while, ...
I was given the following question (please don't mind the programming language semantics, it's a language-agnostic question): Given a list of Persons, and two arbitrary Persons out of that list, we need to find the minimum nth-degree relationship between them. Here are the definitions of Person and a "relationship": A...
Suppose we have a language $A$. I want to prove that $AA^*$ is commutative. I know that this expression equals $A^+$, but I'm not sure how to go about a proof yet. This is my attempt so far. If $A$ is a language, then \begin{align*} AA^* & = A(A^0\cup A^1\cup\cdots) \tag{Definition of $A^*$}\\ & = A^1\cup A^2\cdot...
There's a problem whose solution startles me because at first sigh, I wouldn't imagine that it could be solved so easily. The problem is: There are n tasks, each task t_i has a weight w_i and a length l_i. Find an order of tasks t_1, ... t_j, ..., t_n that minimizes the total cost of completion, where the cost of compl...
Problem 1: Given an undirected graph, return the edges of a Hamiltonian cycle, or correctly decide that the graph has no such cycle. Problem 2: Given an undirected graph, decide whether or not the graph contains at least one Hamiltonian cycle. What is the polynomial-time reduction of problem 1 to problem 2? Let TSP1 d...
During the presentation (a talk) Answer Set Programming: Boolean Constraint Solving for Knowledge Representation and Reasoning Torsten Schaub (University of Postdam) stated around twenty-one minutes into the talk, "You can't translate an ASP (answer set program) into SAT (propositional formula) in a modular way...." co...
I keep hearing about lookahead parsers, LL parsers, LR, LALR, etc... but no clear explanation behind the etymology of this word. What does "lookahead" refer to? How does this relate to LL, LR, LALR? Basic examples would be great, as I'm not well versed in this subject.
I'm trying to determine the big O time complexity of the following data set where the first column is the input size, and the second column is the execution time in seconds. Where possible, I should determine the exponent of the dominant term and provide an estimate for the coefficient on the dominant term. I made the...
I am a little confused by the complexity proof of Radix Sort. For counting sort, the complexity reported is $O(n+R)$, where $n$ is the number of items and $R$ is the range. But this is not entirely correct, right? To do binary arithmetic on numbers as big as $R$, I need $\log_2 R$ operations for any deterministic hashi...
I was reading this post about the DP completeness of the problem SAT-UNSAT (both are well defined in this post). The answer added a note at the end that states the class complexity DP differs from NP, unless NP = coNP. I fail to see why. I searched and I came across multiples posts such at this one and that one that pr...
Just came across this transcript that states: The principle is that prediction is the same thing as compression. And what that means is that whenever you have a prediction algorithm, you can also get a correspondingly good compression algorithm for data you already have, and vice versa. Even though the article gives ...
I have an optimization problem and I want to show its complexity. The optimization problem is the same as the minimum dominating set problem, but with an additional constraint. The constraint is easy. Consider a defined subset $S$ of nodes in a graph. The additional constraint is to guarantee that at least a given numb...
Sometimes you can substitute values for $n_0$ and $c$ in the big-$O$ equation and compare two functions. Or take limits and compare two functions. But for the following functions, for example, taking the limit in infinity for $f_3$ over $f_2$ requires using l'Hôpital's rule which doesn't simplify anything. $f_3$ is tec...
Consider the following problem: You are given $n$ coins with labels $1, \ldots, n$. You know that coins have weights $1, \ldots, n$, but you don't know whether the labels are correct (i.e. they can be in a different order). Using balance scales (the outcomes are $>$, $=$ or $<$) at most $k$ times, determine whether th...
Input: Some fixed $k>1$, vectors $x_i,y_i\in\mathbb R^k$ for $1\le i\le n$. Output: A subset $I\subset\{1,\dots,n\}$ of maximal size such that $(x_i-x_j)^T(y_i-y_j) \ge 0$ for all $i,j\in I$. Question: Can this be computed in polynomial time in $n$? Remarks: For $k=1$ this is equivalent to the problem of finding a lon...
I was reading about $L$-reductions and there was one part in the definition that I thought was interesting. I wanted to know what motivated people who came up with it to have it included in the definition. Recall that a problem $A$ is $L$-reducible to another problem $B$ if there exist polynomial-time computable functi...
Given $x_1,...,x_n,y_1,...,y_n\in \mathbb{R}^d$ find a permutation matrix $P\in\mathbb{S}_d$ that minimizes $\sum_{ij}P_{ij}|x_i-y_j|$. This is an assignment problem and can be solved in $O(n^3+n^2d)$ time using the Hungarian algorithm. Suppose $x_i\sim N(0, I_d)$ and let $v=\mathbb{E}_{x_1,...,x_n}\left[\min_{P\in\mat...
Given a convex hull in $XY$ plane. and we have $n$ points sitting inside it. In one move we can move all the points to right by $1$ or move all the points to up by $1$. what are the minimum number of moves that are required to get all the points outside the convex hull?
https://www.researchgate.net/publication/235662494_On_separating_overlapped_fingerprints [Paper name-"On separating overlapped fingerprint", author-Fanglin Chen,Jianjiang Feng,Jie Zhou] I am unable to understand the process of local fourier analysis in the initial orientation field estimation. I have tried searching o...
Word grammar (w-grammar) is a context free grammar in which all laws are of the following forms: $A \rightarrow B, A \rightarrow \epsilon, A \rightarrow w_1B, A \rightarrow Bw_2$ $A, B \in N$ (nonterminal), $w_i \in \Sigma^\ast$ $ L_{w-grammar} $ - set of all languages that have a w-grammar $ L_{CFG} $ - set of all lan...
∃y∀x [A(x) ∧ B(y) -> C(x,y)] ∃y∀x [¬(A(x) ∧ B(y)) v C(x,y)] ∃y∀x [¬A(x) v ¬B(y) v C(x,y)] I need to convert the above to conjunctive normal form. I'm a little confused about the order of operations in the case of both existential and universal quantifier and which part of the expression they apply to. From the last...
Like including parenthesis (( and )), addition, subtraction, multiplication, and division, and the Order of Operations in mind. I tried (in Lark EBNF): %import common.WS %ignore WS %import common.SIGNED_NUMBER -> NUMBER start: exp ?exp : add | mul | sub | div | NUMBER | frac | parenthesis...
Suppose I have two LL languages $L_1, L_2$, both describable by LL($k$) grammars for the same $k$, and regular language $R$. Which of the following are also LL languages, and can they be described by LL($k$) grammars? $L_1 \cup L_2$ (union) $L_1 \circ L_2$ (concatenation) $L_1^*$ (Kleene star) $L_1 \cap R$ (intersecti...
It is said that a gate that can simulate AND and NOT is universal and able to recreate any classical circuit. I was looking at some of the circuits simulated by NAND, and for some of them, we need to split the output of a gate and direct each of the splits to other NAND gates (see the area circled in red): If we make ...
For each of the 2 pairs of functions I need to figure out the following: g(n) = Θ(h(n))? g(n) = O(h(n))? g(n) = Ω(h(n))? g(n) = o(h(n))? g(n) = ω(h(n))? Pair one g(n) = (64)(n/4), h(n) = 256(n/8) Pair two g(n) = n1024, h(n) 2(lg(n)*lg(n)), lg is base 2 For pair one, I have the limit as n->inf for g(n)/h(n) = inf. The...
I have worked with image classification and image segmentation etc. While working with images we are either mapping from $\mathbb{R}^2\to\mathbb{R}$ or $\mathbb{R}^2\to\mathbb{R}^2$. Are there any machine leaning methods that can map from $\mathbb{R}\to\mathbb{R}^2$. For example, I have a feature vector of $3$-$5$ elem...
Let $A$ and $B$ be two sets of integers with $|A|>|B|$. Given a map $f: A \rightarrow B$ and $i \in A, j \in B$, let us use the shorthand "$i$ is matched to $j$" if $f(i)=j$. I am looking to solve $$ \min_{f: A \rightarrow B} \sum_{j \in B} (\mbox{ number of nodes matched to } j)^2, $$ $$ \mbox{ subject to } |i-f(i)| ...
My question is a follow-up for the following thread: Solving unusual recurrence with two variables I baisically have the same reccurence relation but with a small change--- $$T(n,k) = T(n-1,k)+T(n-m,k+1)$$ The change is the addition of $m$ in the second element in the recursion (instead of 1 in the original question) T...
I have a directed graph representing some topics organized as follows (below screenshot is a subset of the graph): I'm looking for an algorithm to group a set of nodes (in blue in the diagram) following this logic: Groups as evenly sized as possible: we don't want groups with very few nodes and others with lots of no...
Is this regular or not L = {w1w^R | w ∈ {0,1}* (where for any word w ∈ {0,1})*, w^R denotes the reverse of w)
For those who think visually, say I've got 5 warehouses with a current stock level of # of fish, and a target level for each. How do I achieve the new target levels in as few truck shipments as possible? Or given an array A{250, 150, 45, 205, 350}, how can it be transformed to {200, 200, 150, 320, 130} in as few tran...
As far as i understand all loops have a loop invariants. My understanding is that loop invariant is an argument that is true at the beginning of the loop block as well as at the end of the loop. For example: while(P) { //predicate is true here body of the loop //predicate still true here } But let`s say i have t...
How can I convert the regular expression (ab*)*b to a context-free grammar? When I look for examples I keep seeing plus signs in the expression but I don’t have any. Is that just a different way of writing it?
I want to categorise variants of a structure made up of some number of variable components by mapping it to a unique range. Assume that the individual components all fall within the same base range. I'm using color as an example for this question as its intuitive to think about but I don't want the question to be speci...
According to me Statement S1 and S2 is True while S3 is False. The Solution says 'S3' is correct ? Am I Wrong ? Kindly help with explanation . I know Connect() in TCP is used by the client side for generating a request to server while it gets the destination address and port no. as a part of address structure .
I am wondering if it is possible to calculate the following double sum, where $a_1,\ldots,a_n$ are positive integers, in time faster than the trivial $O(n^2)$: $$ \sum_{i=1}^n \sum_{j=1}^n \left\lfloor \frac{a_i}{a_j} \right\rfloor. $$ For example, if $a_1 = 1, a_2 = 2, a_3 = 3$ then the sum is $9$.
As per my research on stack overflow communities, This is probably known as cutting stock problem / multiple Knapsack problem (a variant of the bin packing problem) which is NP hard. here are the constraints: there are two integer arrays one has lengths (already defined), the other has the bin sizes (already defined),...
I'm having problems in finding language of the CFG from given production rules. For example if the production rules are \begin{align} &S \to AS \mid \epsilon \\ &A \to aa \mid ab \mid ba \mid bb \end{align} How can I find the language it describes?
I wonder if there is a formula to calculate the sum of n/1 + n/2 + n/3 + n/4 + ... + 1. (Integer division) The number n can be as large as 10^12, so a formula or a solution having the time complexity of O(logn) will work. This is how far I can get: The sum can be described as n * (1 + 1/2 + 1/3 + 1/4 + ... + 1/n). The...
Usual NbE algorithms for untyped lambda calculus, which use (P)HOAS to embed terms to a host language constructs, results in a beta-normal form of a terms. Is there algorithms to (efficiently) exploit host language constructs to normalize untyped terms to beta-eta normal form?
I am studying Term Rewriting by reading Baader's book "Term Rewriting and All That". I am in the chapter of Equational Unification, in the section of Commutative Functions. I am trying to do the following exercise: Let $s, t \in T(\Sigma, V)$. By exercise 10.10 we know that the $\approx_{C}$-classes of these terms are...
Please help me prove the following problem: A unary function $f(x)$ is said to be partially $n$-computable if it is computed by some $\mathcal{S}$ program $\mathcal{P}$ such that $\mathcal{P}$ has no more than $n$ instructions, every variable in $\mathcal{P}$ is among $X, Y, Z_1, . . . , Z_n$ and every label in $\mathc...
I have a graph in which certain vertices are labeled. I need to assign labels to all of the other vertices in a way that minimizes the number of edges between different-label vertices. How can I do this efficiently?
Does there exist a Deterministic pushdown automata for the language $L=\{ a^ib^j| i \neq 2j+1, i,j>0\}$ where $\Sigma = \{a,b\}$ I have tried to find a pushdown automata and it turned out to be a non-deterministic one.
I know that a NAND gate is considered universal because we can use it to implement an AND, OR, and NOT gate. Given an arbitrary gate, or set of gates, how many operations would it take to verify if these gates are universal (by brute force), and does there exist a more efficient way to do this? How expensive is this in...
I have an array composed of integers from 1 through n. For each integer, I want to count the integers which are greater than that integer and occur after the integer's placement in the array in O(n*log(n)) time complexity Ex: array : {2, 1, 4, 3} For 1, 4 and 3 are after 1 and greater than 1 so 3 and 4 are chosen For ...
I am trying to understand an example of theorem proving via type checking in Haskell given here. The example is as follows. Using the Curry-Howard isomorphism, construct an inhabitant of the type and prove that $N= (A\vee (B\rightarrow A))\& (C\&(C\rightarrow B))\rightarrow ((\neg B\& A)\vee ((A\rightarrow B)\&(B\right...
If FA1 and FA2 are 2 DFAs with minimum number of states. I want to find cross product DFA (FA1XFA2). Will the cross product DFA obtained from 2 minimum DFAs also have minimum number of states(num of states in cross product DFA = num of states in FA1 x Num of states in FA2). How to think on this?
Let's say we have $3^{4n}$ and $4^{3n}$. With the note of The Asymptotic Cheat Sheet from MIT. We should first calculate the lim n->infinity $3^{4n}$/$4^{3n}$. and it result is $\infty$. In the we have lim n→∞ f(n)/g(n) != 0,∞ ⇒ f=Θ(g) Note 1 and lim n→∞ f(n)/g(n)=∞ ⇒ f=ω(g) Note 2 My questions is: Give...
Setup I am trying to write a function that determines if a set of vertices, edges and faces is a pure simplicial complex. A pure simplicial complex is a set where all facets have the same degree, a facet is a simplex that is not contained in a simplex of higher degree. So for example, a single vertex is a facet. A set ...
Let $\Sigma = \{a,b,c\}$, and consider the function $f\colon \Sigma \to \Sigma^*$ given by $f(a) = abc$, $f(b) = bac$, and $f(c) = cba$. We can extend $f$ to $\Sigma^*$ in the obvious way. Since $f(a)$ starts with $a$, it can be shown inductively that $f^{(n-1)}(a)$ is a prefix of $f^{(n)}(a)$ for every $n$, where $f^{...
I showed that, over an uncountable domain,learner A and a distribution P, such that for every sample size m and all samples S from $P^m$ $$ : L_S(A(S)) − L_P (A(S))| = 1 $$ Now I wanna prove for countable domains. Lets assume X = N. I wanna prove that, for sample size m, and every $\epsilon> 0$, there exists a learner ...
I have a simple grammar as below and wonder if it is convertible to regular grammar? If yes, what is the conversion sequence? If no, how can we prove it? S -> A A -> aAA | b | c In which S is the start symbol; A is non-terminal; a b c are terminals. Any help or suggestion is appreciated.
I am going through Computational Complexity by Arora and Barak, and there I came across the proof of why mod $p$ gates cannot be computed by $ACC^0[q]$ circuits, where $p$ and $q$ are distinct primes. The book proves it for $p=2$ and $q=3$, and I am facing difficulties generalizing this result for arbitrary $p$ and $q$...
There may be some theoretical literature, unknown to me, that addresses this question. If possible, I would like a practical approach to this problem. My attempt involves the use of an equational specification language called CafeOBJ (see introduction). In particular, the BOOL module can be viewed as a formalisation of...
The problem here described was taken from a university exercitation session. A serial production line is made of $K$ workstations: one kind product is manufactured by this line and has to be processed by each of this workstation. In each workstation are present equal machines in parallel. Stations are separated by an i...
I know that a Deterministic TM single tape has an equivalent Deterministic TM multiple tape, but I can't get how a Deterministic TM multiple tape can simulate a non-deterministic TM(The mecanisme). Regards, Thank You
Let's say I have a context-free grammar G and a string S. The normal CYK algorithm outputs that s can not be build using G. How would I find the closest String S' that can be build using G?
I want to know whether a given neural network (with a finite number of nodes) is able to store all injective maps f: D -> C, where D has cardinality k and C has cardinality N (so the number of maps is N! over (N-k)! ). For example is a network with 1000 nodes able to store 60 injective maps from {1,2,3} to {1,2,3,4,5}...
I'm trying to figure out of if there's a way to generate all unique sets of integers of length K, where each member has an upper bound of N, and a lower bound of M, without tracking which sets have already been generated, where the order doesn't matter. To be clear: I'm not looking for ways to filter duplicates from a ...
I find several contradictory definitions regarding the head movements of the Turing machine. In some places, it is only L / R. While in some other formal definition; it is L / S / R. Which one is correct?
I'm trying to prove the language L = {$0^n 1^$ | x ∈ Σ*, n ≥ 1} is regular, but don't know how to present it in a DFA/NFA. I'm thinking to have n+1 states in a NFA, with the start state as the accepting state. The NFA reada $0$s to go from q$0$ to q$n+1$, then reading $1$s or $0$s to stay in the q$n+1$, then reading th...
Suppose you have access to a random number generator $G()$ that generates uniform random numbers in $\{0,\cdots,n-1\}$. (Here, $n$ is given and cannot be changed.) How do we generate a uniform random number in $\{0,\cdots,m-1\}$ for $m\leq n$? We require that we can only call $G()$ $O(1)$ times in expectation. My effor...
Going through the topic of LBA, i.e., Linear bounded automata. I found that LBA requires the NTM with some constraints on tape. I found the same information from different sources. But I did not get why all the sources mentioned that it needs a NTM. I am not getting why I need a NTM for LBA? We also know that any NTM c...
So, I was going through the Rod-Cutting problem in the Dynamic Programming section of the Introduction to Algorithms by CLRS. Here's the rod-cutting problem statement: Given a rod of length n inches and a table of prices pi for i = 1, 2,…n, determine the maximum revenue rn obtainable by cutting up the rod and selling t...
I am working on an NP-complete problem and, I have proposed an efficient (as I think) Integer Linear programming to find the solutions in some small instances. My algorithm can work on a greater size instance in comparison to other studies. My tutor does not consider it sufficient to provide just one ILP algorithm and,...
I need to find a Turing machine that decides $A=\{0^{3^n} | n\ge 0\}$. I tried doing the same as Sipser does on page 172 in his back, where he creates a Turing machines that decides $A=\{0^{2^n} | n\ge 0\}$, by iterating over the input, and crossing (by writing $x$) on every other $0$. I wanted to cross every third $0$...