instruction
stringlengths
35
29.1k
for $L1$ regular language, $L2$ some language, $L1$ \ $L2$ is regular, decidable. yet, the next transition function might not even be computable: $F′=${$\,q:δ(q,w)∈F \, for\, some\, w∈ L2\,$}$.$ $F$ is the accepting states group of DFA accepting $L1$. $F'$ is the accepting states group of DFA accepting $L1$ \ $L2$ $HAL...
I would like to know what is the VC dimension of the following hypothesis class. $$H=\left\{f_{\theta_{1}, \theta_{2}}: R^{2} \rightarrow\{0,1\} \mid 0<\theta_{1}<\theta_{2}\right\}$$ where $f_{\theta_{1}, \theta_{2}}(x, y)=1$ if $\theta_{1} x \leqslant y \leqslant \theta_{2} x,$ else $f_{\theta_{1}, \theta_{2}}(x, y)=...
I'm working through the "Properties of Relations" chapter of Software Foundations, but have got stuck on one of the exercises, lt_trans'': Theorem lt_trans'' : transitive lt. Proof. unfold lt. unfold transitive. intros n m o Hnm Hmo. induction o as [| o']. (* FILL IN HERE *) Admitted. The base case for the i...
I recently came across the iterated algorithm function denoted as $\lg^* n$. But I am having a hard time understanding this statement: $\lg^* n = \min \{i \ge 0: \lg^{(i)} n ≤ 1\}$ I could not understand what $\min$ set is used to signify. Also, could someone please provide an example of how this works. I also came ac...
How many binomial trees are in a binomial heap with 27 elements and how would you find this number?
Consider the following problem: Let $A = \{a_1,...,a_n\}$ and $B = \{b_1,...,b_m\}$ be two finite sets over $\mathbb{N}$. The sequences $a_1,...,a_n$ and $b_1,...,b_m$ do not have to be sorted. Given as inputs the strings $a_1,...,a_n$ and $b_1,...,b_m$, determine if $A \subseteq B$. What is the time complexity o...
I've been reading a book about turing machines and it has a challenge about a building a Turing Machine that has as many 0s as many 1s but that can appear in any order. I don't understand how do you set the reading to the beginning and then make a transition to the beginning. But it deals with only 0s that shows up be...
I was given the following problem to solve: Consider a system that has 128 compute units of the same type. Suppose that a program runs for 1025 time units on a single compute unit. The total amount of serial work for this program is 1 time unit. Compute the maximum speedup achievable for the given system. I am confused...
What complexity class results would be implied by a proof of the existence of one way functions. (Apart from the obvious $P \neq NP$) I thik it would imply $P \neq UP$, but what else?
Arr is an array that contains $ n$ numbers. Suggest the most efficient algorithm for each case and analyze the runtime. Explain why the algorithm you chose is the best one. Arr contains exactly $\frac{n}{5}$ distinct values. Arr contains integers in the range $[0, … , ^7 − 1]$. There are exactly ( − √) integers in...
I've been searching a few hours for a proof to Max independent set in planar graphs beeing in PTAS but I couldn't find anything, I'm searching for one without any reductions and I wonder if anyone here can help me find one. Thanks in advance.
I think that the next language is not decidable but I can't think of reduction to show it. I would appreciate some hint or intuition $EQ = $ { $<M1,M2>$ |$ M1\,\,\, and\,\,\, M2 \,\,\, are\,\,\, TMs\,\,\, and\,\,\, |\,L(M1)\,∩\,L(M2)\,|\, $$= 2020\, $}
I recently learned that regex support backreference which enables referring to a matched group in the pattern itself. E.g. a regex (.)\1{2,} matches two or more consecutive appearances of the same character like 'aa', '...', '------', etc. However, such feature seems exceeds the capability of finite state machine which...
I'm given a (not necessarily binary) tree. Now every node can have a signal with range $i$, reaching all nodes being at most $i$ edges away. The cost of a signal is determined by a function $f(n, i)$ with $n$ being a node and $i$ being the signal strenght. The cost for each node may vary, the only assumption one can ma...
As we all know, in offline problems it is common practice to calculate the integrality gap to get some bound on the approximation ratio of the integral solution. Now this gap ($IG:=\frac{OPT_{frac}}{OPT_{int}}$) relies on the fact that we can compute the fractional optimum by just solving the relaxed linear program of ...
Say, I have a database table with $N$ columns. What is the (theoretical) maximum number of indices I can create on that table? For $N = 1,2,3$ it's easy enough to calculate the answer $(1, 4, 15)$, but is there any formula? Also, is there a "name" for this number?
I'm having a hard time wrapping my head around the proofs Lemma 11 and Lemma 10 (Pages 10 and 11) in this paper called: Preemptive and Non-Preemptive Real-Time UniProcessor Scheduling. Generally the proofs have very few steps in between and I can't seem to understand how the author continues from one step to another. ...
I am looking for an efficient algorithm to compute $$f(x) = x^a, x\in[0, 1] \land a\,\text{constant}$$ If it helps, $a$ is either $2.2$, or $1/2.2$. Knowing valid values for $x$ and $a$ could make it possible to take some shortcuts a general pow function cannot make. General tailor series expansion has some serious con...
Almost every time I see an article about time or space complexity, people are expressing the complexity with Big O, whereas it should be $\Theta$. From the book "Cracking the coding interview": "In industry (and therefore in interviews), people seem to have merge Θ and together. Industry's meaning of big O is ...
I get that complexity theory will be helpful to decide whether the resources at hand can deal with a mathematical function, but when presented with a non-purely mathematical problem - like building a robot that can cook, drive or make beds - how can we know whether it's feasible?
Can we proof the number of NFSTs with $n$ states : $n.2^{mpn}.2^{n}$ where $p$ is the cardinal of input alphabet and $m$ the cardinal of output alphabet.
I'm trying to solve the following exercise: Given N data items and memory that can hold M/B blocks of size B. Describe a data structure that needs at most N/B blocks of external memory and allows us to answer questions of the form "$s \in S$?" using $\log_BN$ I/O operations. We may assume a static set, i.e. we do n...
If a given time complexity, such as these: $(n + \log n) * \sqrt{n+\log n}$ $n * (200 + \log^2 n)$ $(7+n^3)\log(n^5)$ is not determinable by just looking at it whether is it in class $O(n^2)$ or not, how do I decide? If a time complexity is given, and in it there are more types of expressions (exponential, logarithmi...
I am interested to know what is the fastest algorithm (complexity wise) known to us to solve the following linear program. Due to its simplicity, I hope for a very fast algorithm. Your help is greatly appreciated and I would appreciate you providing me with relevant papers as well. Context: I am trying to give an algor...
When can we say that a Monte Carlo algorithm solves a problem? To quote from Wikipedia on Monte Carlo algorithms For instance, the Solovay–Strassen primality test is used to determine whether a given number is a prime number. It always answers true for prime number inputs; for composite inputs, it answers false with p...
I am citing the definition of the Hitting Set Problem from (Gardy & Johnson, 1979): INSTANCE: Collection $C$ of subsets of a set $S$, a positive integer $K$. QUESTION: Does $S$ contains a hitting set for $C$ of size $K$ or less, that is, a subset $S' \subseteq S$ with $|S'| \leq k$ and such that $S'$ contains at least...
Introduction to computer science Level 109 I don’t understand the question
My question is whether a specific decision problem—finding a computation path through a "leapfrog automaton"—is in P or not. It's straightforwardly in NP, and it resembles the hamiltonian path problem in some respects, but it also seems a little easier and I haven't been able to find a reduction. Definition. A leapfr...
Can anyone help me understand why the Ford-Fulkerson algorithm does not work in the case of irrational capacities?
So the way I understand it, if station A and station B, for example, try to transmit a frame at the same slot, a collision occurs, leading to an attempt at the next slot. But wouldn't the algorithm just repeat itself? The same two stations would try again on the second slot and it would still cause a collision. Also, i...
How would you write a method to change the value of a min heap where bool changeKey(int oldKey, int newKey). The keys are unique, no duplicate keys are permitted. If there is a key in the heap with value oldKey, and no existing entry with key newKey, it will change it to newKey, keeping the the heap properties and retu...
You have two arrays, a and b Both contain n elements, all positive and distinct. you have to create a pair, by taking one number from each array, such that the sum of the differences of the pairs are minimized. for example, a = [1, 2, 3], b = [4, 5, 6] one possible set of pairs = (1, 4), (2, 5), (3, 6) sum of differen...
Every introductory CompSci resource I can find goes through how 8 bits are in a byte, etc. So a byte can store some 2^8 values in binary. Then when asking about four bytes, we can assume this is (2^8)^4=2^32. But I can't find anywhere if this pattern holds up until the total amount of hard drive or memory storage. For ...
In the book 'Computational Complexity' by Arora and Barak the following question is posed (exercise 2.20.): Let REALQUADEQ be the language of all satisfiable sets of quadratic equations over real variables. Show that REALQUADEQ is NP-complete. I know how to show NP-hardness, but I'm stuck when it comes to proving tha...
I fail to find much about how to efficiently calculate whether a propositional formula entails another. Considering the following two points... We can check, for each truth assignment which makes the first formula true, whether it also makes the second true. If all of them do, the first entails the second. It works fo...
I have to prove that the function $f\colon \mathbb N × \mathbb N \to \mathbb N$ defined by $f(x, y) = x + y$ and $|x| = |y|$ isn't a one-way function. How do I go around doing that?
The function: for (int i=1; i<n²; i++) for (int j=i; j<n; j++) print(j) Putting it into a relation, I got: $C1 + \sum_{i=1}^{n^2}(C2+\sum_{j=i}^n(C3))$ After solving it $C1+C2n^2+C3n^3-(C3\frac{n^4}2 + C3\frac{n^2}2)+C3n^2$ What I can't figure out is the complexity of this relation. Solution (...
I can't seem to find an answer to this. For instance, I have this question: Show that, if $P=NP$, there aren't any pseudo-random generators (even with amplification factor $n+1$). My gut tells me this is because, in a world where $P=NP$, pretty much any process can be efficiently inverted so there aren't one-way functi...
I'm trying to learn Computational Geometry and this formula isn't obvious to me. Hint: cross is related to the cross product of two vectors. # Returns intersection of infinite lines ab and pq (or undefined) point intersect(point a, point b, point p, point q): d1 = cross(p - a, b - a) d2 = cross(q - a, b - a) ...
Just like the title says. I want to prove that given two languages $L_1,L_2 \in BPP$, $L_1 \cup L_2 \in BPP$ and $L_1 \cap L_2 \in BPP$
Like the title says. I can't figure out how to prove this. I think it probably has to do with the polynomial hierarchy collapsing but I'm not sure.
Suppose I have an edge-weighted connected rooted DAG $G = (V, E, r \in V, w \in E \to \mathbb{Z})$ where there exists a sequence of nonempty sets (called "levels") $L_0 = \{r\}, L_1 \subset V, \ldots, L_n \subset V$ such that $L_0 \cup \ldots \cup L_n = V$ and the outgoing edges of the nodes in $L_i$ only connect to no...
I have a hard time understanding how to convert the following context free grammar to Chomsky Normal Form: S $\rightarrow$ aSX | B B $\rightarrow$ bBX | ε X $\rightarrow$ a | b I have a solution S $\rightarrow$ EY | EZ | FY | FZ | ε E $\rightarrow$ YS F $\rightarrow$ ZB Y $\rightarrow$ a Z $\rightarrow$ b that does not...
I am fairly new to algorithms and I am dealing with a problem I cannot fully translate into mathematical language. So, I am given the array [1,1] and I can only perform one sum between their numbers per step, ie you can only pick between: [x(s+1), y(s+1)]=[x(s)+y(s),y(s)] or [x(s+1),y(s+1)]=[x(s), x(s)+y(s)] but not ...
Let M a finite state transducer define as : $M=<X,Y,S,\delta,\lambda>$ What we mean by quasi-linear finite automata?
Is it true that $2 S A T \subseteq S A T ?$ and in general is $k S A T \subseteq S A T $ where k is any positive integer is true? Thanks.
Consider a MAC protocol (ALOHA, CSMA, TDMA, etc.) that, even for very high loads, always results in a throughput of 1 (normalized with respect to the channel speed). Why is that not good if the throughput is equal to 1?
The 3D-matching problem is known to be NP-complete even if all elements occur at most three times (see Garey&Johnson). My question: Is it also NP-complete if all elements occur in exactly three triples? The 3D-matching is defined as follows: Let $W, X, Y$ be disjoint sets with $|W|=|X|=|Y| = q$. Let $M \subset W \times...
Assume generating means that for all $k$ there exists $N_k$ such that after $N_k$ steps the $k$th cell on the tape consists of the $k$th digit of $\pi$'s binary expansion and will stay there forever. Can such a machine exist? can it not? EDIT Is this true for every irrational number? So this is true for $\pi$ since the...
We are given a Boolean circuit $C(x_1, \dots, x_n,y_1, \dots, y_n)$ with $2n$ inputs and we have to determine if the graph $G_C = (V_C, E_C)$ (specified below) is connected: $$V_C = \{0,1\}^n, \\ E_C = \{((a_1, \dots, a_n), (b_1, \dots, b_n)) : C(a_1, \dots, a_n,b_1, \dots,b_n) = 1\}.$$ To which class this problem belo...
Just like the title states. If I have a pseudo-random generator $g\colon \Sigma^n \rightarrow \Sigma^{2n}$ and a one-way function $f$, is $g'(x)=f(g(x))$ a pseudo-random generator? And why? My instinct tells me it is, but I can't really explain why.
Let $G = (V,E)$ be any undirected graph. Let $k$ be some number and $C = |u \longrightarrow v|$ where $u \longrightarrow v$ means there is a path from $u$ to $v$. We want to add $k \subseteq V \times V\ E$ edges into $G$ such that $C$ is maximised in the new graph. Question : What is the fastest algorithm for this prob...
I have to prepare 30 minutes of oral examen about the subject called parsing. Where I have to talk about it. And then I shall hand in like 30 pages (including code and figures etc). I don't know how to structure it and what I can talk about. So what I really need is a disposition! What I have thought about this far: L...
In Fiesler (1994) Neural Network Classification and Formalization, he talks a lot about a more general version of neural networks, one that is not ordered into layers, but rather the network is called slabbed and the "layers" are instead called clusters. Unlike for feed-forward networks, slabbed networks may be cyclica...
Is there a way to enumerate, by size (the size of a pair is ||+|| but if the enumerator represents them in some different way than simply concatenating them (like via some different encoding) then we are just talking about the size || of the string in the enumeration that encodes the pair (,)), from biggest to smalles...
I'm confused about the point of adaptive arithmetic coding. I understand that static arithmetic coding involves using preset probabilities of symbols that remain static during the whole process. I also understand that adaptive arithmetic coding involves change all probabilities after each symbol encountered. However, w...
Can an $NDTM$ perform a set of operations on all strings of a given length $b$, at the same time? Aka can it operate on all strings of a given length by doing something like: spawn $2^b$ branches then operate on each string of length b on each branch? How could it do this tho if the branches can't communicate? That's w...
Under section 5.4 Quality of Service on page 404: Multimedia applications in particular, often need a minimum throughput and maximum latency to work. Isn't this statement incorrect? Shouldn't it be : Multimedia applications in particular, often need a maximum throughput and minimum latency to work.
I am studying the computational complexity of the following decision problem related to 2QBF: Input: a 3-CNF formula $\varphi$ over $X \cup Y$, where $X$, $Y$ are disjoint sets of propositional variables, and an integer $k \geq 0$. Question: does there exists an assignment of the variables from $X$ such that all assig...
Here is an excerpt from Andrew S. Tanenbaum, Computer Networks, 5th edition, Chapter 5 (The Network layer), Page 455: My question is on the second paragraph. From what I understand, basically this part talks disadvantage of using NAT(Network Address Translation). I don't understand what second paragraph is trying to s...
I've come across the following problem on leetcode & tried to solve it with the following code however there seems to be an even better solution that takes advantage of XOR. Leetcode has a description for XOR solution however I can't grasp it in its entirety. I just can't wrap my head around why we need to initialize m...
I have an if-then-else condition with three binary variables A, B and C: if A + B = 1 then C = 0 How do I express this as an integer linear program with equality constraints?
I recently attented to some computational complexity talks (or complexity theory, I am not sure which is the correct name) and I fell in love with it. I would like to find some books, online courses... in general resources of any kind to self-study this (securely) wonderfull subject. My backgrund is pure mathematics wi...
For a kernel function, we have two conditions one is that it should be symmetric which is easy to understand intuitively because dot products are symmetric as well and our kernel should also follow this. The other condition is given below There exists a map $φ:R^d→H$ called kernel feature map into some high dimensional...
Any idea is appreciated. A generic approach that works for any system would be best but if you want more info about what I'm looking for, the equations are usually short (having few variables, from 1 to 4 at most), but in exchange, there are a lot of equations (30-60). The system is known to always have these propertie...
I have a problem understanding the difference between complexity of enumeration and counting. We can solve every counting problem using enumeration algorithm. Now, I have problem with the following. Let say that we have to count the number of positive integers less or equal than positive integer $N$. We know that the a...
I have an idea of how to approach the problem, but I'm not sure about it. Given a Turing Machine, I can check how many states the machine has, and somehow by the number of states to know if the run uses endless cells of the tape. However, I am not sure how I can use the number of states and what I should check. What co...
In Quantum Information and Quantum Computation by Nielsen and Chuang, they define the complexity class NP as follows (page 142): A language $L$ is in NP if there is a turing machine $M$ with the following properties. If $x\in L$ then there exists a witness string $w$ such that $M$ halts in the state $q_Y$ ("yes state...
I have two 2D arrays: $P[n][s]$ and $C[n][s]$, $s \leq n$. P contains sets of nodes and $C$ the cost of a set in $P$, e.g. the cost of $P[2][2]$ is $C[2][2]$ and a set $p \in P = \{ s_0, s_1, ..., s_{n-1} \}^q, q \leq n$, e.g. $p=\{s_0, s_3\}$. For every row I can pick at most one set but in the end the union of the pi...
How do I prove that the following language isn't context-free using the pumping lemma? $$ L=\{w_1\#w_2\#\dots\#w_k \colon k ≥ 2, w_i \in \{0,1\}^*, w_i = w_j \text{ for some } i \ne j\} $$ I am having trouble choosing the string to use for the proof. I know that I have to choose a string such that at least two substrin...
I was self learning about entropy and came across this equation. $$ H = - \sum p(x) \log p(x) $$ The equation for entropy in expected value, $$ H(x) = \operatorname*{\mathbb{E}}_{X \sim P}[I(x)] = -\operatorname*{\mathbb{E}}_{X \sim P}[\log P(x)]. $$ But the expected value is written as $$ \mathbb{E}[X] = \sum_{i=1}^k ...
I'm working on an algorithm that computes lots of "nearest point on a triangulated surface" queries in 3d as a way to resample data sets, and I'm wondering if there is any information out there on speeding up these queries. My gut tells me that partitioning the set of query points in a voxel grid or something, and doin...
Let $L_1$ be some language in $R$. Let $L_2$ be some language in $RE$. Is it necessarily that $L_1 \leq_m L_2$ ? I know that for non trivial $L_1$,$L_1$ in $R$ it is right to say that $L_1 \leq_m L_2$. But I can't prove the first case. and another question: I am almost certain that the following is true, though I have ...
I came across the question: What are the minimum and maximum numbers of elements in a heap of height $h$? To which I came up with this theory: $$\sum_{i=0}^{h-1} 2^i = 2^h-1$$ $2^h-1$ is the internal nodes and that is understood according to the understood fact. But because nowhere except CLRS mentions heaps to be a ...
In some problems related to the Ising model in physics and mathematics the following problem comes up: Suppose I have a graph $G$. Then an even spanning subgraph of $G$ is a subgraph where you keep all the vertices and some of the edges such that each vertex has even degree.There is always at least one since the empty ...
We can write inductive types in terms of a fixpoint type: Fix : (* -> *) -> * In : (f : * -> *) -> f (Fix f) -> Fix f NatF r = () + r Nat = Fix NatF Z = In NatF (InL ()) S n = In NatF (InR n) But this fix type is not sufficient for indexed datatypes and we need an indexed fixpoint: IFix : (I : *) -> ((I -> *) -> (I -...
The Observational Equality from Epigram 2 seems to be intensional equality (like Coq and Agda have), but it also supports function extensionality. In that sense it seems that Observational Equality is better in every way than intensional equality in a type theory. Is it true that it's always better to have Observationa...
Coq (and other type theories such as Setoid Type Theory) have a Prop universe for propositions. As far as I understand this universe is needed to be sure that the propositions can be erased. In Quantitative Type Theory one can explicitly say which parameters are only used in types and can be erased. Does Quantitative T...
Originally posted in Stack Overflow but was told to post here. Context: I am doing a PCA on a $M \times N \, (N \gg M)$ matrix with some invalid values located in the matrix. I cannot infer these values, so I need to remove all of them, which means I need to delete the whole corresponding row or column. Of course I wan...
Consider that you have a permutation of $n$ elements from $1$ to $n$ and you need to sort the elements lexicographical . for example sorted permutation for $n=11$ is $1,10,11,2,3,4,5,6,7,8,9$ .Now consider this notation $Q(n,k)$ as position of number $k$ in lexicographical sorted permutation. $Q(11,2)=4$. We are give...
Given G(V,E) a graph that has 2 connected components, what is the diamter of this graph?
Are there any "natural problems" which are known to be NPI under weak assumptions. By weak assumptions I mean something like $P \neq NP$ or $NP \neq Co-NP$
I am having trouble understanding the following statement regarding Turing reduction: "If P1 is reduced to P2, then P2 is at least as hard as P1." Does this mean that (i) P2 can be harder or as hard as P1, or (ii) P2 can be easier or as hard as P1? To represent this visually... I would appreciate any insight on the ...
I was going the text Introduction to Algorithms by Cormen et al. Where I came across the following statement in the proof of the third case of the Master's Theorem. (The Statement of Master theorem) Let $a \geqslant 1$ and $b > 1$ be constants, let $f(n)$ be a function, and let $T (n)$ be defined on the nonnegative int...
Below is a problem worked out in the Introduction to Algorithms by Cormen et. al. (I am not having problem with the proof but only I want to clarify the meaning conveyed by few statements in the text while solving the recurrence and the statements are given as ordered list at the end. Simply because I want to master th...
I wonder what is the best data structure I can use in order to achieve the following: Given a data structure based on a balanced BST, I would like to get a tree with the $\lfloor\frac{n}{2}\rfloor$ greatest values in $O(1)$. I thought about maintaining another balanced BST and a variable containing the middle value, bu...
There is a tool called JFLAP, which, among other things, can analyze push-down automata, and find non-determinism. In this example it is detecting non-determinism in state q0: The first symbol in the transition represents the symbol read as input; the second symbol represents the symbol extracted from the stack; and t...
Question: An email campaign has a sequence of email messages where each email message belongs to one of two categories: transactional (and/or) marketing. Given the campaign size n and the gap length k, find the total number of distinct valid campaigns. My Approach: My initial thoughts were around generating all the v...
First case: I was stumble upon a two step sequential algorithm where the big O complexity of each step is $O(N^9)$. Second case: Also if the algorithm have three steps where the complexity of step 1 is $O(N^2)$, the complexity of step 2 is $O(N^3)$ and the complexity of step 3 is $O(N^9)$ What would be the complexity o...
I am trying to understand the technique of using configuration history in proofs. To prove that: $\{<M>|M\,\,\,is\,\,\,a\,\,\,TM\,\,\,and\,\,\,L(M)=\sum^* \}\notin RE$ given $<M,w>$ we have built a Turing machine that accepts all words except M accepting configuration on w. (and then simple reduction) To prove that: $\...
I am trying to determine whether Kolmogorov complexity is computable for a specific language. I am certain this given language is not Turing-Complete. The language is defined as follows: $A;B \text{ - executes instructions A and B one after the other.}$ $!x_i! \text{ - sets variable } x_i \text{ to the value }2.$ $\{...
I recently came across the sentence in the Book Introduction to Algorithms section 4.1 The maximum sub-array problem: We still need to check $\binom{n-1}{2} = \Theta(n^2)$ subarrays for a period of $n$ days. Here $n$ is the number of days taken as an example to show the changes in price of stock. We can consider this...
Lets say we use the predictive parser LL(1). Why is it necessary that $FIRST(\alpha) \cap FIRST(\beta) = \emptyset$, for all $\alpha, \beta$ right side of alternative productions i.e., productions associated to the same non-terminal. Why is this condition necessary?
How to prove if P = NP if problem Π ϵ NP-complete and Problem complement Πc ϵ NP? OR P = NP if NPC intersects with Co-NPC
The pieces of information available to us are the number of leaves in a tree and that each internal node must have at least two children. Is there a way to find the upper bound on the total number of nodes in the tree?
I would love to have a direction for the following exercise (the material for this exercise is greedy algorithms): Let $G = (V,E)$ an undirected graph whose vertices $V = \{v_1,\dots,v_n\}$ appear in this order on the real line (meaning forall $1 \leq i < j \leq n$, $v_i$ appears before $v_j$). A $d$-divison of $G$'s v...
I have found this reference for the C syntax Backus-Naur Form (BNF). I was wondering if there are any other ambiguities in this grammar other than the infamous "dangling else"? Also how we can modify the BNF grammar to avoid those ambiguities, including the known one mentioned above?
Let N and M be arbitrary 1024+ bit integers. The objective is to compute the product of N and M (2048+ bits) There exist various multiplication algorithms for various bit lengths (ex library: GMP). But there is always the assumption that both numbers are equally arbitrary. Are there algorithms that are even faster unde...
Construct a Turing machine for M = {wvw| v, w ∈ {a, b}*, reversal(v) = w}. I tried to imagine that I will have to divide the string into 3 equal parts and check if the first and last part are identical, and that first two parts form a palindrome. But not sure how to proceed with this to construct the turing machine.
We have N tasks that need to be scheduled for processing. Each task consists of two parts that need to executed in order. The first one is guarded by a mutex and therefore only one task can be executing this part at a time. The second part has no such constraint and any number of the tasks can be executing this at the ...