instruction
stringlengths
35
29.1k
I would like to develop an application that outputs text from the audio of 2 possible languages. For ex: Audio might be English or Spanish, it should return the spoken words. Most speech to text APIs strongly rely on an input language for words retrieval, I would like to know if there's any tool or research paper that ...
how would you draw a DFA for the language over {a,b,c} of all words where every occurrence of b is preceded and followed by a. My thinking of this is that the regular expression for this is a* c* (aba)* a* c* although I am not too sure. Any help would be appreciated thanks
Someone could explain me in a simple way why Bruce Hayek theorem guarantee an optimal schedule for Metropolis algorithm? For me is enough an informal explanation. Thanks.
This question is extended from this Algorithm to generate integer sets fulfills restrictions, in the answer I learned the formal term of this problem, and the recursive algorithm described in that answer also gives me the desired sequence - as much large numbers located in the front as possible, for example, we will ge...
What is known complexity of language {a | a = x^2}, is it possible there exist deterministic Turing machine (one input tape and one work tape) that accept this language in linear time?
Here is a question that I found into an old exam: Describe an algorithm that, given a context-free grammar $G$, can determine if the language $L(G)$ produced by $G$ is finite or infinite. Hint: use the pumping lemma. While I found several possible solutions to the problem (mostly exploiting the presence or non-presen...
Down below is a Term rewriting system where I am trying to find the critical pairs, decide if it is confluent and find the Normal terms. I think it's difficult to understand all these concepts and I am just mixing everything up, I think. Problem Consider the $TRS$ \begin{equation} \begin{split} (R_1)\quad x\cdot (y + z...
I've been curious why machine learning algorithms with high VC dimension, such as XGBoost and deep learning, do well in practice. The answer appears to be regularization significantly restricting the parameter space, but the only justifications I've seen are references to Occam's razor. Is there quantitative/theoretic...
I have multiple questions actually.. a)What is a System bus? Is there any other buses in the computer? b)Is it always the case that , the processor access the memory via the system bus? c) I read that " another master requests the access ".. What are these masters exactly? Is processor the bus master by default? P.S. I...
I have known that: A function $\Bbb N → \Bbb N$ is recursive if and only if its graph is a recursive subset of $\Bbb N^2$. Now I am considering about the partial functions. Is it the fact that: A partial function $f:\Bbb N\dashrightarrow\Bbb N$ is partial recursive if and only if its graph is a recursively enumerabl...
Both the broadcast algorithm and the flooding algorithm seem exactly the same to me, some sites try to explain the difference but then other sites contradict their statements. At the moment I see both algorithms starting at a specific starting node. This starting node will send a message to all of its neighbors, and on...
I'm working on a problem where I have a directed acyclic graph and I need to repeatedly flip all incoming (or outgoing, or both incoming and outgoing) edges from a single vertex. I think that resulting graph is still a DAG. Am I correct?
I am looking for an algorithm that given a PDA $M$ decides whether there exists $w \in L(M)$ for which there exists a decomposition $w = uvxyz$ that satisfies $|vy| \geq 1$ and $uv^ixy^iz \in L(M)$ for every $i \geq 0$.
I experience that my students are fixed to compute with concrete values and are not keen to think in terms of general solution like creating a mathematical function $f(n)$ , needed to write programming functions f(n). What is a good method of teaching them this lesson, becoming able to think in abstractions like functi...
There is a famous problem to generate a random permutation of elements in an array - it's called shuffling. My understanding of that problem is that I have to put every element in an array into a random position. So for each element in an array I can generate a random position and put it there by swapping: for (let i =...
Does Curry howard correspondence, apply to all Functional Program, e.g. in Haskell. i.e. Is it possible to write Equivalent Haskell programs, to COQ proofs?
I'm writing some notes about functional programming, so I'd want to describe some features of the category theory. I visited wiki page about Category of Set, and I found this: "The epimorphisms in Set are the surjective maps, the monomorphisms are the injective maps, and the isomorphisms are the bijective maps". I'd wa...
In most bibliography, only cut(v) is defined. More properly, only cut(v,v.parent) is defined, where (v,v.parent) is an edge in the represented tree. The pseudo-code and code for this is: cut(x): access(x); parent(left(x)) = null left(x) = null void cut(Node *x){ access(x); x->left->parent = 0; x->lef...
Let's say $\alpha$ is simple word if it couldn't be represented as $\beta^{n}$($n$ times concatenation of $\beta$), where $\beta \ne \alpha$ Consider two sets: $p_{N}(L) = \{\alpha^{n} | \alpha \in L ; n \in N\}$ and $SL = \{ \alpha | \alpha$ - simple word, $\alpha^{n} \in L; n \ge 1 \}$, where $N \subset \mathbb{N}$. ...
A boolean-valued function defined in the set of positive integers, $\mathcal Z$. $$f(n) = \begin{cases} 0, &n_{min}\le n < n\ast\\1, &n\ast\le n\le n_{max} \end{cases} ; n \in \mathcal Z $$ $f(n)$ is computationally expensive and it's analytical form (a closed-form equation producing these binary-valued outputs is unkn...
given a Deterministic Finite Automata, I am looking for a formal construction of Push Down Automata with 3 states such that the languages of the DFA and the PDA are the same. How we can prove correctness? Any help appreciated. Thanks!
I want to learn Cryptography and so I am interested to master C-programming. I know the basic concepts of C-programming like how to use an array,pointers etc. I want to develop myself so that I can find the different loopholes in the security of different cryptosystems. Basically I want to work in Attacking of Cryptos...
You are given a minimum heap, with probability going to left is 50% and going to right is 50%. What is the probability that You will land up on a maximum element in the heap? For this scenario since going to right and left have equal probabilities we can state the answer to be $(1/2)^{O(\log n)}$ . As at each step we ...
While I am reducing the following term, I encountered a little Problem: $$(\lambda w x. w x)(\lambda w x. w x) \rightarrow_\beta (\lambda x.(\lambda w x. w x) x)$$ Now my first question: Why is it possible to reduce further after doing alpha conversion? Isn't the last x bound be the first lambda? Second Question: In ...
I have the following task: Given an array a holding positions and array b holding values, order the elements in the array b according to the positions in the array a. For the input: a = [3, 0, 1, 2]; b = ['a', 'b', 'c', 'd']; the output should be [ 'b', 'c', 'd', 'a' ] I have written a simple algorithm which s...
I am given an $n\times n$ matrix, $M$, that denotes the outcome of a series of races between $n$ contestants. Each contestant $i$ races against every other contestant $j$ and we say $M_{i,j}=1$ if $i$ beat $j$ (note $M_{i,j}=1\Leftrightarrow M_{j,i}=0$.) We then say that racer $i$ placed in the tournament if they lost ...
I am trying to show that $L^* \in P $ does not necessarily mean that $L \in P$. My idea was to find a language $L \notin P$ , apply $*$ operator and show that $L^* \in P$ by showing that $L^*$ can be decided with a polynomially bounded Turing machine, which will be a contradiction to $L^* \in P \Rightarrow L \in P$. Ho...
I have a problem that I have no idea how to approach. I've been looking at using mapping reductions, but I can't find a way to apply it. Assume some alphabet $\Sigma$ and two languages $A, B \subseteq \Sigma^*$. Define the language $A / B = \{x \in \Sigma^* \mid xy \in A \text{ for some } y \in B \}$. Prove that if bo...
Most functions that generate random numbers are described as: Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive) If I use it to generate a number in the range [0..9], does uniformly distributed mean that the probability for 3 and 8 is the same? As I un...
I made a Huffman algorithm for data compression: it takes the content of a file as an input and outputs a compressed string. More important, it generates optimal prefix codes (made of 0 and 1) for every possible character, that is to say for every number between 0 and 255. While the size of a code cannot exceed 256, it...
S-> AAB|ABA|BAA|epsilon A->aS B->bS this is a grammar of the language L4 = {w ∈ Σ*: #a(w) = 2#b(w)} over Σ = {a, b} Does the following examples shows that the L4 is ambiguous? S->AAB->aSAB->aAB->aaSbS->aab S->AAB->aSaSbS->aab I'm not sure if these derivations are the same, if they are not, what are the derivations th...
Suppose you have a Turing machine, but with a countably infinite alphabet. How does such a Turing machine differ from an ordinary Turing machine, either in terms of computability or of complexity classes? Do complexity classes for ordinary Turing machines hold up in such a model? Edit: quick addendum - it seems obvious...
The Turing machine was invented by a human mind. Presumably, nothing less powerful than a Turing machine can invent a Turing machine. However, a Turing machine has infinite tape, whereas the mind is situated in a finite universe, and thus can only be a TM with finite tape. A TM with finite tape can be simulated by ...
Been having some trouble trying to come up with a CFG for this language: all binary strings that contain least 2 1's and at most 2 0's So far, I've come up with this: S --> T | 0T | T0 | T0T | 00TT | TT00 | 0T0T | T0T0 | 0TT0 | T00T T--> 1T | V V--> 11Z | 1Z1 | Z11 Z--> 1Z | epsilon I realize this is mostly likely inc...
finding the index of first zero entry in a binary string: Input: binary string ($0$'s and $1$'s) Output: index of first zero entry Can you give a circuit for finding the index of first zero entry in a binary string with minimum depth and polynomial many processors? 1) Is this problem in $AC_0$? 2) Is this problem in $...
How is tamper-proofing of software evaluated for effectiveness? I've been implementing a few algorithms listed within Surreptitious Software: Obfuscation, Watermarking, and Tamperproofing for Software Protection. The algorithms include tamper-proofing of software by means of introspection (or computing a hash at runt...
I am tring to prove the NP-completeness of the following Binary Integer Linear Program (BILP): $$ \text{min}\sum_i\sum_j x_{ij}\\ \text{subject to} \sum_jr_{ij}x_{ij} \geq R,\ \ \forall \ \ i \in [L]\\ \sum_i x_{ij} \leq 1,\ \ \forall \ \ j \in [N]\\ x_{ij} \in \{0,1\}.$$ This a resource allocat...
There is the original problem, and an equivalent problem. The equivalent problem: construct a set $A$ that contains bit arrays of length $r-1$, where $|A|=2^{r-1}/r$ and $hamming \space distance (i, j) = 3 \quad \forall i, j \in A, \space i \neq j$. Misha Lavrov gave an excellent answer on Math.SE that solves the origi...
Say I have the following Standard-Dual linear program: $$max<\vec b, \vec y>$$ $$s.t.:A^Ty \le \vec c$$ $$\vec y \ge \vec 0$$ Is there a way to transform it to a Canonical-Dual and equivalent linear program, i.e., that of the following form: $$max<\vec b', \vec y'>$$ $$s.t.:A'^Ty' \le \vec c'$$ $$\vec y' \in \mathbb R^...
I have the language $L = \{0^i1^j0^i1^j\ |\ i+j > 0\}$ I and want to prove that it is not context-free by using the Pumping lemma for context-free languages. I am new to this field and I am having some problems with the constant $n$ given by the Pumping Lemma. I do not know how to express $i$ and $j$ in terms of $n$. I...
I was wondering if there is a statement about the spacecomplexity of F and FNP, like P subset of NP subset of PSPACE?
It's complexity is $\mathcal{O}(\log^6n)$ and $\log^6n$ is not a polynomial. Can we say that primality testing is strictly contained in $P$ then?
I'm thinking how I can insert an element into an ordered array. Assume the array has a capacity for one element. I've implemented two methods. The one finds the position to insert, moves elements one position to the right and inserts the element into the position. The seconds one which seems more intuitive to me is to...
https://en.wikipedia.org/wiki/Busy_beaver#Proof_for_uncomputability_of_S.28n.29_and_.CE.A3.28n.29 So this is wikipedia's proof of why Busy Beaver Function is uncomputable. But I don't get two things. How do you know that < Create_n0 | Double | EvalS | Clean > has $N$ states? I understand that < Create_n0 | Double | Ev...
As I understand it encrypted emails have a high profile (detectable through pgp header / attachment). Would it be possible to match the encrypted data with a wordlist to hide the fact that the email contains a encrypted message? I know that the other person would need the same list of words for decrypting and the mes...
Is there any computable real number which can not be computed by a higher order primitive recursive algorithm? For computable real number I mean those that can be computed by a Turing machine to any desired precision in finite time. For higher order primitive recursive algorithm I mean common primitive recursive functi...
I want to know the difference between Bandwidth and propagation speed. How are they associated with each other i.e. the impact on bandwidth if propagation speed varies or the impact on speed if bandwidth varies. I have gone through this difference between propagation speed and bandwidth in digital communication still I...
EDIT: Seems like what this structure is nothing more than a 26-bit bitwise trie, as KWillets suggested in the comments! You can think of the words we insert the trie as 26-bit Bitsets where the i-th bit indicates whether the word contains the i-the letter in the alphabet. As I was tackling an interview problem I came...
In the proof of the predecessor subgraph property (page 14 of the following notes) http://www.cs.sfu.ca/CourseCentral/307/binay/shortestpath.pdf $d[v_i] \geq d[v_{i-1}]+w(v_{i-1},v_{i})$ is assumed true. Why is this? Shouldn't it be the other inequality: $d[v_i] \leq d[v_{i-1}]+w(v_{i-1},v_{i})$ by triangle inequality...
So, I was reading about L-systems and it seems that L-systems are in many ways analogous to context-free grammars. Is there a corresponding automata for this? I can't seem to find anything on the Wikipedia page.
This question is similar to, but distinct from this one, in that I am considering a specific case that demonstrates an apparent inconsistency in how I see Big-O notation used. I would like to be sure I am properly evaluating the run time of this algorithm. Imagine we have a list of strings, such as this: words = ["eat"...
I was reading the following paper on Robustness and Generalization (and covering numbers)and I was reading their example 1: which didn't quite make sense to me. The reason it didn't make sense is that intuitively it seems to me that each region $X_i$ could have the label either +1 or -1, so it seems to me that the par...
I'm following this article to do a formal proof on elliptic curve cryptography. My question here addresses only a property "easily proved by induction". Definitions (the important part is the addition definition at the bottom) Let assume the following hierarchy: abstract class shf; case class const(c: Integer) extends ...
Given a string comprised solely of the characters $\text{a, b, c}$ we want to know the number of different $(i, j, k)$ triples such that $0 \leq i,j, k < n \text{ (here n denotes the length of the string)}$ satisfying the following two conditios : $\bullet \text{ }s[i] = "a", s[j] ="b" \text{ and } s[k] = "c"$ $\bulle...
A simple linear pipeline has three stages. The execution times in the stages are 10, 15, and 12 units respectively. If the pipeline is used to process 100 inputs, then the execution time is (a) 1530 units (b) 3700 units (c) 1500 units (d) 1537 units I am not able to understand this question. can anyone help me to u...
Designing following language $\{ w \mid w\in\{0, 1\}^* \mbox{ such that } |w|_0 = |w|_1\}$ is easy. Note $ |w|_0 $ means number of occurrences of 0. $$ S \to 0S1 \mid 1S0 \mid SS \mid \lambda $$ Then how about this? Language $\{ w \mid w\in\{1, 2, 3\}^* \mbox{ such that } |w|_1 = |w|_2 + |w|_3\}.$ It is somewhat diff...
Say we want to factor a large number. Factoring it is in NP. Verifying it is definitely in P. However, how do we know that there is no other factors besides the one we found? So it seems that verifying it isn't in NP either. Now I am getting confused with NP definition here. I know that NP includes all P. But then the...
I have data like this. [0 1 0 1 0] [0 1 0 1 0 1 1] [0 1 0 1 ] [0 1 0 1 0 1 1 1 1 0] ... I want to classify with Neural Network but my data different size . I can not delete or add more arbitaly data. It may make the result not correct. So, How to classification data different size ?
I am looking for some clues as to the type of algorithm/data structure or general field of CS to look into... I have a collection of items that I would like to have a human subjectively compare such that I can derive some consistent dataset that can be queried for k nearest neighbours for a given item that is present i...
I was asked in one of my homework tasks this next question and I'm not quite sure how to handle it: Sort(w) is an operation which takes a string (w) from a given language and sorts the characters in an ascending order. Sort(L) is the outcome language of the operation Sort(w) on each and every string (w) in the language...
Is it true that if SAT is in coNP then its also coNP-complete (because it is NP-complete)?
It is known that union of two context-free languages is also context-free. But how about union of context-free and non-context-free languages?
I'm trying to understand the Cook-Levin theorem proof, as it attempts to create a polynomial-time reduction from any NP problem to SAT (as presented in the book by Michael Sipser). Most requirements are absolutely clear, but I don't understand why the $\phi_{cell}$ formula is required. Of course, a tableau with improp...
Im studying a book called "Engineering a compiler" by Linda Torczon and Margaret Cooper. In the second chapter which discusses lexical analysis they mention three aproaches to writing a lexical analyser: 1. Table-driven, 2. Direct coded and 3. Hand coded. My question is: how do hand coded lexers generally work ? Are th...
Let define formula $\Phi%$ given in CNF and it's complement $\overline \Phi$. $\Phi$ is satisfiable iff $\overline \Phi$ is not tautology and vice versa. $\Phi$ can be converted to $\overline \Phi$ in polynomial time using following method: Change all literals with non-literals and vice versa: $\forall i:x_i \Rightarr...
I am working on an optimization problem. Let's say we have a grid of bins where solid metal cubes could be placed. We have a number of colored metal cubes to be arranged in the bins. Each of these cubes weighs 1kg. But the weight could change slightly over time due to natural phenomena like rusting and becomes 1kg + de...
I am in need of an algorithm for a part of a game (a mod) I am making. I have abstracted the problem: Given a 2D space with $N$ random points $p_1...p_n$, calculate the nearest neighbor of each of the points, where the distance is at most $C$. Note that our list of points is unsorted, and that each point is an actual o...
Why some books state that Primes is a NP problem if, as a decidibility problem, it can be solved in polynomial time? A simple example: A number can has its primality tested by dividing it by all numbers from 2 to \sqrt(n). It then takes at most \sqrt(n) operations to find if its prime. After talking to colleagues, some...
Lets consider the following language : $L = \{1w |w \in \Sigma^*\}$ (Alphabet is 0 and 1). I know this language is regular, I just have to prove it now, the Problem here is the number of equivalence classes, I thought it would be: $[1] = \{x|x $ starts with 1$\}$ and $[\epsilon] = \{x| x$ doesn't start 1$\}$. But now...
I am using N-Grams to predict future character input. For n+1, it performs really well. I've been looking, but I have not been able to find any information on what the feasible maximum distance into the future N-Grams are capable of. One way I could do this is to predict the next character (n+1) and then use that resul...
How can I negate the following sentence: For all words x from L with |x|>= n , exists decomposition x = uvw with |uv| <= n and |v| >= 1, so for all i >= 0 , is valid that u(v)^iw in L is.
Let's say I have an algorithm something like as follows: 1 eliminate stuff from a list called reactions 2 for each element in reactions: 3 if one thing is computable: 4 compute it 5 else: 6 eliminate element from reactions, GOTO 1 Can I change it too 1 eliminate stuff from a list called reactions ...
Given $L_1$ and $L_2$ over some alphabet: $L_1@L_2 = \{uv \mid u \in L_1 \land v \in L_2 \land |u|=|v|\}$ The question is: if $L_1$ is regular and $L_2$ is context-free, is $L_1@L_2$ context free? I've been trying to disprove this but to no avail. So I've been thinking to prove this by buiding a PDA but I can't seem to...
I was asked the next question in my homework assignment: I just want to make sure that I fully understand what it is that's required of me. Am I asked to find an algorithm which decides if the language that's accepted by the PDA is finite? And if not, then what is it? Any initial intuition? **I don't need help with ans...
I am reading an article related to streaming algorithms named "Turnstile streaming algorithms might as well be linear sketched" by Yi Li, Huy Nguyen and David Woodruff, At some point they have a random algorithm (uses a tape of random bits) that solved a problem over $\mathbb Z_{|m|}^{n} = \{-m,..,m\}^n$ that succeeds ...
Can you suggest me a good book with illustrative examples and problems with solutions for finite languages and automata theory? I tried Hopcroft's but it has mostly theory and not many problems with solutions. Thanks! :)
A partial function is one, that that is only defined on a part of its domain. Haskell gives examples: https://wiki.haskell.org/Partial_functions My end goal is to express types $$ \prod_{D:\mathcal{U}} D \qquad\qquad\qquad\qquad \prod_{\mathcal{A}:\mathfrak{A}} \mathcal{L}(\mathcal{A}) $$ The first type should simply ...
The lecture note by Jeff Erickson discusses "Evasive Graph Properties": We call a graph property evasive if we have to look at all $\binom{n}{2}$ entries in the adjacent matrix to decide whether an (undirected) graph has that property. As an example, it shows that connectivity is evasive. I want to know: Is acyclici...
Given functions $f, p, c$, a matrix $X$, and vectors $C,D,E$. I want to maximize the multivariable function $f(X)$, where $X$ is a $p \times q$ binary matrix ($X_{ij}$ is 0 or 1). So, $p\cdot q$ variables. The function $f(X)$ is given by $$ f(X) = \sum_j \sum_i C_{ij} X_{ij} - \sum_j p(X,j), $$ where $C$ is a matrix of...
Given 2 polygons in a plane: $A : ( (xa_1,ya_1), (xa_2,ya_2), ... (xa_n,ya_n) )$ $B : ( (xb_1,yb_1), (xb_2,yb_2), ... (xb_m,yb_m) )$ Is there a polynomial algorithm to compute a matching $M$ between the points in A and B, such that: If $(xa_i,ya_i)$ is matched to $(xb_p,yb_p)$ and $(xa_k,ya_k)$ is matched to $(xb_r,yb...
How much memory do we need to train a multilayer perceptron? I've started to figure this out myself, but I'm stuck. I have one-layer MLP. Each training example is a vector of 100 real numbers in float32. There are 1000 training examples. The hidden layer is 50 units. The output layer is 10 units. Karpathy's excellent ...
I'm trying to create a genetic algorithm to train neural networks (because I'm to bad at back-propagation), and it works well until generation 18, where the loss stops to decrease and gets constant. The loss gets from 112 to about 90 in 18 generations and almost doesn't change: Here is the genetic algorithm (I think t...
Consider a context-free grammar where all rules produce at most one non-terminal (i.e., there is at most one non-terminal on the right-hand side of a rule). What is the class of languages which are accepted by such a grammar? If you like, we may assume that all rules are one of the following forms, where $V, V'$ denote...
In Skip Lists: A Probabilistic Alternative to Balanced Trees by Pugh he suggests different strategies for choosing the level of an inserted node. One such strategy, called fix the dice, limits the level to our previous highest level plus one if a higher level was randomly chosen. What are the practical implications of ...
I have recently come to realize that a number of problems I had a few years ago trying to implement various mathematical theories in Java came down to the fact that the typing system in Java is not sufficiently strong to model all of Martin-Löf dependent type theory. Prior to Java 5 and generics, the only type theory...
Say I have a number 45 What are the factors of 45? 1, 3, 5, 9, 15, 45 Is there any other factors? I know that if I want to find some non trivial factor of some number, say 45, I know it's in NP. I can non deterministically choose some 2 numbers and verify that those 2 numbers are factors of my large number. Verifying i...
I am solving a problem of planning a meal, where I need to fulfill requests such as "create a two-dish meal that MUST have at most 2g of fat, the first dish MUST have 400kcal and SHOULD have at least 10g of protein, and the second dish MUST have 100kcal" by returning a list of dishes from a predefined list. In other wo...
I'm given $n$ numbers (let's say of some 100 bits or so). Is there a way to find a non-empty subset xor of these $n$ numbers which has the least Hamming weight (no. of set bits) in better than $O(2^n)$ complexity? I was thinking of some trie based implementation but don't think that will work at all. Would a dynamic pr...
I'm wondering if there are any parallel algorithms whose runtime is not linearly dependent on processor count. (Assuming the problem-size remains constant for different processor counts) For example, suppose p processors has a O(n^2) runtime and p+1 is O(n^1.5). To me, it seems if that were the case, you would just use...
Given a sequence of numbers $l_1, \ldots, l_k$, I want to find for each $i$ the nearest numbers to the left and right of $l_i$ (if any) that are strictly smaller than $l_i$. Is it possible to do this in linear time?
A problem X is NP-hard if every problem in NP can be reduced to X. But every problem in NP has a polynomial time verification algorithm, so then does that not mean that I can also verify X in polynomial time because every NP problem is reducible to X? Can someone please explain or give an example.
Is there a finite state transducer which has a set of Unique Input/Output sequences such that, when the UIO sequences are concatenated together, the resulting string is shorter than its shortest preset distinguishing sequence, supposing that the finite state transducer has a preset distinguishing sequence?
I have a simple context free grammar $(\{A\}, \{(,)\}, R, A)$, which consists of this one production rule: $A \rightarrow AA\, \vert\, (A)\, \vert\, \epsilon$ I believe this is ambiguous! For example, I can represent "()" like this: I'm sure there are an infinite number of these. I've attempted to make the grammar un...
This is task from the German IT contest ("Bundeswettbewerb Informatik"), but since the deadline is past, asking this question is no cheating. Given a vertex-weighted, directed graph $G=(V, E)$ and values $c_v$, find a subset of nodes $V_{res}\subseteq V$ that maximizes $$\sum_{v \in V_{res}} c_v$$ subject to $$\forall ...
It seems to me that the algorithm is over complicated. It makes use of tables, buckets, and sorting, which all seem unnecessary. I don't understand why I can't just fill between pairs of scan line intersections, ignoring vertices and edges with gradient 0. My lecturer didn't provide the best notes on this algorithm, an...
I want to prove the non deterministic space hierarchy theorem. Let $f(n),g(n)\geq\log n$ be space constructible functions such that $f(n)=o(g(n))$, Prove: $$NSPACE(f(n))\subsetneq NSPACE(g(n))$$ I feel that the standard way of constructing a TM that takes as an input a TM and simulates the machine on itself, then flip...
I need help understanding why the two statements I have underlined with red are correct. I am confused as to how we can get $n + 1$. And how $i \le n$ is true when it says $i < n$ in the while.
is it possible to rewrite the following sql statement $\pi_{R.a,S.d} (\sigma_{R.b = "d" \land S.d \geq 100 \lor T.d \geq 200}((R\times S)\times T))$ ? My problem is, i dont know if it is possible to split $\sigma_{R.b = "d" \land S.d \geq 100 \lor T.d \geq 200}$ to $\sigma_{R.b = "d"} \land \sigma_{S.d \geq 100 \lor T....
I'm trying to come up with an argument of why shell sort should be used over insertion sort for an array of 10 elements. And I'm wondering if there is one at all. I know that insertion sort is more efficient for the mostly sorted array, but in all other cases the shell sort should be faster. Or there will no significan...
apply1 : (a -> b) -> Foo a -> b apply2 : (a -> b -> c) -> Bar a b -> c apply3 : (a -> b -> c -> d) -> Baz a b c -> d As you see there is a repeating pattern, we obtain a function and a data structure, then we apply that function and return its result... Is it possible to abstract over this pattern...