instruction
stringlengths
35
29.1k
I'm completely stuck on Problem 4.10 of the Motwani-Raghavan Randomized Algorithms textbook. I don't want an answer, but hints may be helpful here. I understand the general Valiant scheme for the boolean hypercube but am unable to generalize to an arbitrary regular graph: "Suppose we run Valiant’s scheme on an N-node n...
I'm having trouble understanding state tables for turing machines where the state table shown in the above image is supposed to show the change from the top turing machine to the bottom such that an extra 1 was added at index 5. I don't see how when S0 reads 1 (at start, index 1) and shifts the head right it then read...
I have new logic which has syntax and semantics in usual natural languages and I have to create theorem prover/solver/reasoner for this logic. Is there framework or tool set that can generate such prover from the formal definition of grammar and semantics? I have heard about Isabelle/HOL, is this right set of tools. Is...
It is known that given a Context Free Grammar $G$, checking that it is ambiguous or not is undecidable. But, if I have a string $s \in L(G)$, does there exist an algorithm to check whether $s$ particularly can be derived unambiguously in $G$?
Given a polynomial $f\in\mathbb{F}[x_1,\ldots,x_n]$ what is the computational complexity of computing a generating set of the automorphism group of $f$? On first look this seems like a hard problem (at the least NP-hard). Is the complexity of the above problem studied earlier?
The book Theory of codes by J. Berstel and D. Perrin from 1985 studies variable-length codes. The focus is less on error-correction and compression, but more on algebraic properties, synchronization and connections to automata (especially unambiguous transducers). A code over a finite alphabet $A$ is any subset $X$ of ...
I am to arrange the following 30 functions in terms of increasing order ( all the lg (log) are to the base 2.log* represents iterated logarithm.) Here's my answer (the functions on the same level are of the same order): 1 , lglg*n lg*n, lg*(lgn) , , , , I am not sure where to insert (lo...
Brief introduction: Let $n \in \mathbb N$. The non-equality function, denoted $ NE : \{0,1\}^n \times \{0,1\}^n \to \{0,1\} $ is defined as follows: \begin{align} \forall x,y\in \{0,1\}^n \;\;\; NE(x,y) = \begin{cases}1 & x\neq y \\ 0 & x = y\end{cases} \end{align} In the setting of two party communication complexity,...
Imagine there are 3 direct-mapped cache designs possible, all with total 8-words of data: C1 has 1-word, C2 has 2 -words block, and C3 has 4-word blocks. Assume the sequence of memory accesses is 3,180,43,2,191,88,190...etc a) Draw a table with each reference being a row and decimal address, binary address, index, tag,...
Brief introduction: In two-party communication complexity, as presented by Yao in 1979, we model protocols as binary trees whose internal nodes are labeled by either Alice or Bob, and the leaves are labeled with possible A node labeled by Alice is a step in the protocol in which she speaks. In these nodes that belongs...
Is there a real world nonmathematical example of computer software that isn't primitive recursive? I'm not interested in examples that are somehow closely related to theory of computation or logic (like automated theorem proving, model checking, compiler design etc.), or examples that aren't primitive recursive in a tr...
The question is: Given an array of size N, arr, create another array whose index i = number of elements in sub-array(arr, i+1, N-1) that are greater than arr[i]. Eg. if input array is, 5 3 9 8 2 6 output array is 3 3 0 0 1 0 O(N^2) is simple just two for loops. I think a O(N*logN) is possible by starting from last e...
I am trying to prove the statement in the title. I have a hard time proving it is true. The way I go about it is by using the definition of $\omega$: $c\times g(n) < f(n)$; So that if $f \notin \omega(g)$, then $\mathrm{NOT} (c\times g(n)<f(n))$ means that $c\times g(n) \geq f(n)$. And that by definition is Big-Oh. Is ...
Is there any literature/survey/papers/books regarding the factorization of Strong PseudoPrimes (wrt. to a given base). I am aware of the fact that weak Pseudo Primes can be factorized in Polynomial time. But, I was unable to get anything significant/detailed regarding Strong PseudoPrime factorization (I am aware the g...
i'm trying to understand how to add two numbers in IEE754 half precision format , i haven't found a good reference/tutorial on this , so i've tried to follow the 32 bit floating point addition procedure , but at some point i'm stucked , what i know is: Half precision (16 bit) IEEE 754 floating point number bit configur...
Is this problem NP-complete? I have many restrictions like this and want to find a feasible solution: ((a and b) xor (c and d)) = 1 with a,b,c,d are arbitrary literals. It looks similar to XOR-2SAT but has additional ANDs inside the clause.
I'm trying to prove that the following CFG can be converted to a CNF: S -> aAB A -> aAa A -> bb B -> a Here below is how I've managed so far: Step 1: add a new start state S0 -> S S -> aAB A -> aAa A -> bb B -> a Step 2: remove epsilon rules There are no such rules in this CFG. Step 3: remove non-terminal to non-term...
In the last section of chapter 3 (page 57) in Probability and Computing: Randomized Algorithms and Probabilistic Analysis by Mitzenmacher and Upfal, a randomized algorithm is discussed for finding the median of a set $S$ of distinct elements in $O(n)$ time. The algorithm discussed is a Monte Carlo algorithm. As such if...
I was wondering if you could double check on the following statements being true, false or non-conclusive (as in in some cases true, but false in others). Here they are: 1) $F(n) = \log (n^n)$ implies $F(n) = \Theta(\log n)$. Answer: It is a tough one? It is confusing because of $n^n$. My assumption would be to have it...
A Reed-Solomon error-correcting code consisting of N symbols is guaranteed to detect up to N single-symbol replacements in an arbitrarily long input plus the ECC itself, and is also guaranteed to correct up to floor(N/2) single-symbol replacements in the same. I can't claim to understand the math behind Reed-Solomon EC...
For the following (related to a binary tree complexity question): $$f(n) = \sum_{h=0}^{\lg{}n} h2^h$$ Is there any way to express this only in terms of $n$? Or approximate it? Put in another way, I figure at worst for an upper bound, we could guess at it in the following way: $f(n) = 0 + (1 \cdot 2) + (2 \cdot 2^2) + ...
This proof is a proof by induction, and goes as follows: P(n) is the assertion that "Quicksort correctly sorts every input array of length n." Base case: every input array of length 1 is already sorted (P(1) holds) Inductive step: fix n => 2. Fix some input array of length n. Need to show: if P(k) holds for all k < n,...
This algorithm computes the number of ways one can make change for n cents assuming one can use six types of coins. Singles, half dollars, quarters, dimes, nickels and pennies. In the following algorithm, what is this type of algorithm called ? Is it dynamic or greedy ? Also, how do I start about finding the complexity...
So I've been given a piece of pseudo code that involves nested loops. The answer to this question is Θ(n^5) but I do not understand why it is so. What is the time complexity of this code? for i = 1 to n for j = 1 to n*n for k = 1 to j Task where the time complexity of Task is Θ(1)...
Let $\varphi:\mathbb{N}\to\mathbb{N}^*$ be an arbitrary recursive enumeration of finite strings and $\mathcal{I}^n_i(x_1,...,x_n) = x_i $ be the $i$-th projection over $n$ variables. I would like to show from the point of view of recursion theory that the "variable" projection $$ (n,y) \mapsto \mathcal{I}_y^{\text{le...
Use examples to identify the need of join dependency. This is what I have gathered from different website's. SQL joins are used to combine rows from two or more tables. A Join Dependency (JD) over a relation schema R is a statement of the form |><|[schema(R1), schema(R2), …, schema(Rn)], where R = {R1, R2, …, Rn} is...
It is known that an infinite language $L\subseteq \{a\}^*$ is regular iff the set $U:=\{x|a^x\in L\}$ is ultimately periodic. (A set $U\subseteq\mathbb{N}$ is said to be ultimately periodic if there exists bound, $n$, and period, $p$, such that $\forall x\ge n, x\in U\iff x+p\in U$) My question is given a finite formal...
In the modal logic K does □ distribution over →? For example, would the following be correct? □(p → q) ≡ □p → □q
Given two polyhedra(with triangulated faces), P1 and P2. I want to create a polyhedron P, which is the result of joining the two at their region of contact. With join I do not mean union but physically, it is more like welding P1 and P2, so if there is say a cylinder(P1) and a cube(P2) aligned on same axis with P1 part...
In the answer by Raphael to the question "Is there a system behind the magic of algorithm analysis?", there is an equation: $$\qquad\displaystyle \mathbb{E}[C_{\text{swaps}}] = \frac{1}{n!} \sum_{A} \operatorname{inv}(A) \tag{1},$$ where $A$ is an array, $\mathbb{E}[C_{\text{swaps}}]$ is the expected number of swaps it...
According to my lecture and wikipedia NOR and NAND flashes are the most common used. However there isn't really explained why people decided to use these logic gates instead of others. Can someone explain me, what are the factors deciding which gates to use and show how these gates match those properties best?
The Max-2SAT problem asks if at least k clauses of a 2CNF formula can be satisfied. The Max-2SAT(at-most-3) problem is the restriction in which every variable occurs in at most 3 clauses (counting positive and negative occurrences together). It is known that this problem is APX-hard, the reference being this book. ...
In literature in general, are DFS and BFS considered to be special cases of best-first search? Suppose the cost function is: $f(n) = g(n) + h(n)$ Is it correct to reason that if and $g(n) = depth(n)$, then If $\forall_n h(n) = 0$, we have a breadth-first search If $h(n) = i$, where i is the number of nodes visited befo...
I'd like to minimize the number of circles $C$ to cover a set of points $P$ in 2D. There is no fixed radius however each circle must contain exactly $N$ points. The circles may overlap. A point may be covered by multiple circles. All coordinates are floats. Problem size: $|P| \leq 1000$, $5 < N < 15$ My current approac...
Looking something up in an unsorted list is a task with time complexity $O(n)$. However, if the list is sorted, the time complexity is $O(\log(n))$. That means it is sometimes worthwhile to sort an array. However, that is a trade-off as a sorting algorithm has a time complexity of $O(n\log(n))$. As far as I know, you c...
9.9. Construct a reduction from Accepts-$\lambda$ to the problem Accepts-$\{\lambda\}$: Given a TM $T$ , is $L(T) = \{\lambda\}$? The question is from Martin's Introduction to Languages and Theory of Computation. I know how reductions work though I am unsure of several things. It's easy to see that if the inner machine...
Is there a concept for comparing algorithms in artificial intelligence theory similar to reduction in complexity theory (Wikipedia)? I'm asking this because I was wondering how AI algorithms are to be classified in terms of general applicability. As far as I'm aware, AI techniques are largely classified by which prob...
I'm looking for pointers to algorithms which will find long connected similar subsequences which two given sequences have in common. For example, in case of two strings: abcaabbaabUVWXYZ UVWXeYZababababab I'm interested in: **********UVWXYZ UVWXYeZ********** Not in: ab*aabba*b***** ******aba*ab*bab (which would be o...
Probability-related Info theory question that I can't figure out. Thanks in advance!
Problem: Given (a,b) and (c,d), find if you can you reach from (a,b) to (c,d) if we can only have the following moves (a, b) to either (a+b,b) or to (a,a+b). Example (1,4) to (5,9) is possible because: (1,4) -> (5,4) -> (5,9) Solution: I can think of is recursive search Set 1: TestedPoints, initially empty Set 2: P...
I have the following divide and conquer algorithm that finds a clique in an undirected graph $G = (V, E)$: CLIQUE(G): 1) Number the vertices V as 1,2,3...,n where n=|V| 2) If n = 1, return V 3) Divide V in v1 = {1,2,...,[n/2]} and v2 = {[n/2]+1,...,n} 4) Being G1 the subgraph induced by V1 and G2 the subgraph induc...
L = { < M1,M2 > | M1,M2 are TM's and Ɛ ∈ L(M1) ∪ L(M2) } Where Ɛ = Epsilon I know that this language is undecidable, but why it is semidecidable too. What i have tried is => Using Rice's Theorem, part 2 T(no) = (0,1)^+ and T(yes) = (0,1)* Which gives that T(yes) is not a subset of T(no), and this says that it is sem...
Recently I was solving a counting problem, which needed this subproblem to be solved: Given integers $n$ and $t$ (where $1 \le t \le n$) and a decreasing function $f$, find the number of permutations $p_1, p_2, \cdots, p_n$ which satisfy: for all $1 \le i \le t$, $p_i \le f(i)$, and for all $t < j \le n$, $p_j \ge f(j...
It is well established that the class of recursive languages is strictly contained in the class of recursively enumerable languages (Rec $\ne$ RE). Any finite language is decidable and hence can not be RE-complete. My intuition is that an RE-complete language contains infinite number of (finite) strings (information) a...
Consider processes A and B and the situation where either A will send a message to B or B will send a message to A. Is there a standard algorithm for this scenario that makes sure that exactly one of these two interaction took place? In a naive implementation where both A and B decide independently whether to send or r...
I have a doubt regarding bounded waiting. Deadlock implies no Progress because the processes take indefinite time to decide who will enter the critical section . But, Does deadlock implies no bounded waiting ? I think No because bounded waiting is per process and deadlock is for the system. Moreover, In a deadlock, bou...
Here is the problem is want to solve: I want to connect nodes with directed labelled edges, but this two nodes are potentially themselves graphs, hypergraphs or the current structure I don't have a name for. Here is a simple example with a graph $(v_1,e_1,v_2)$ where nodes $v_1$ and $v_2$ are connected by $e_1$. I wan...
By reading literature on (denotational) semantics of types, I see that people tried to give several models of types. Reynolds showed that types in general cannot be given a set semantics in classical set theory. However, it was shown later that constructive sets could be used. Now, I also stumbled upon papers where typ...
According to the lecture, a virtual address first goes to the TLB. If the TLB hits, it is then checked, if something has to be either read or written from cache. In case of writing, it is then checked, if the write access bit is on. If yes, then it is tried to write to the cache. However now it can happen, that the ...
Say I have return A[n-1] + Sum(A, n - 2). I counted the following primitive operations: return A[n-2] + Sum(A, n - 2) 1 2 3 4 5 6 7 I know accessing a certain index in A counts as 1 primitive operation, but I am not sure about A in the function call. Did I count the right number of operations?
A dynamically resizing array list will resize when the number of elements reaches a power of two. So, after n elements inserted, we've resized at sizes 1, 2, 4, ... , n. This also means we've copied over into the newly resized array 1, 2, 4, ... , n number of copies. What then is the sum of this sequence? To answer tha...
Consider the class $\text{DLOGTIME}^{\text{ALL}}$: the class of problems that can be solved by a machine with unlimited computational power but only access to logarithmically many bits of the input. Which bits of the input it accesses can depend on the values of bits it has already seen, and it has random access to th...
G → G B ⏐ G N ⏐ ε B → ( E ) E → E ( E ) ⏐ ε N → ( L ] L → L E ⏐ L (⏐ ε For this grammar, the prompt asks to describe in the language that this grammar describes and builds. I got to the point of first trying at defining the language each one builds but the recursiveness of this grammar threw me off a bit. I'm k...
I've got a DAG of around 3.300 vertices which can be laid out quite successfully by dot as a more or less simple tree (things get complicated because vertices can have more than one predecessor from a whole different rank, so crossovers are frequent). Each vertex in the graph came into being at a specific time in the o...
I recently came across a problem where I was charged $50 by a merchant with my bank card but there was a communication error, so the money was taken from my account but never arrived in the merchants account. I have contacted both banks and neither know what happened to the money. How could one would construct softwar...
It is said that Church Numbers are encoded as following c0 = λX. λs:X->X. λz:X. z; c1 = λX. λs:X->X. λz:X. s z; c2 = λX. λs:X->X. λz:X. s (s z); c3 = λX. λs:X->X. λz:X. s (s (s z)); The church numbers are terms, right? but the terms are given by the following syntax. t ::= terms...
I haven't done much algorithm writing till now. I have a specific scenario and I am wondering which approach shall I take. Scenario: Let us suppose that we have 4 guys (A,B,C,D) We want to assign them a certain task whose duration varies from 40 mins - 1 hr 15 mins. The task duration varies depending on the number ...
Consider a 4-regular, finite, non-directed, integer-weighed graph $G$. Let each node carry an integer value indicating its distance from zero on a hypothetical axis $X$. Take a given node $N$ for which we know its distance from zero (either negative or positive) and the weights on the edges incident to it. Note, that f...
I'm reading a book at the moment about logic gates and Boolean simplification. There is a part which I can't seem to follow. I can easily work out that $A \vee (\neg A \wedge B) \equiv A \vee B$ using a truth table as it's easy to see. However, I can't seem to turn $A \vee (\neg A \wedge B)$ into $A \vee B$ using step...
I'm reading papers regarding microblog credibility perception of non-text cues. Tweeting is believing? Understanding microblog credibility perceptions by Morris et al., 2012 Microblog Credibility Perceptions: Comparing the United States and China by Yang et al., 2013 However, Yang et al.[2013] refer to some cues, suc...
I just stumbled upon this question here Why is the clique problem NP-complete? and I am confused by the given answer. The question about about whether $k$-clique is NP-hard for a fixed $k$ and the answer is no. However, we know that clique in general is NP-hard. Also we know that $0 \leq k \leq n$ must hold (for a gr...
Are there any known upper/lower bounds on the size of a witness of some np-complete/hard problem, or more precisely the relation between the problem size and the witness size. For example, I'm interested in subset sum, set cover, SAT, hamiltonian cycles. If there is something known for other problems, I'd also be inte...
From a database theory point of view, what term can be used to refer to a key that does not violate the rules of the engine within which it is implemented, but fails to conform to any sort of normalisation? For instance, if a timestamp was used as a primary key. Primary keys are supposed to ensure that no two rows refe...
In reference to this problem (equivalently, findind a maximal clique in an undirected graph), I believe greedy approach should work (i.e. removal of people who have maximal qualms with others.). Though I cannot prove that this would always work or won't but I intuitively felt that it should, but eventually some example...
When I take a look at the proofs for pumping lemma, I have a feeling that I am often missing the intuition behind the condition |xy| ≤ p. What exactly is the reason behind this condition? All the literature I have taken a look at are either silent (no proof, no discussion, only a statement) about this point, or state t...
I have that language $S=\{a^n b^m c^m\mid n,m \geq 0\}$. How can I prove with the pumping lemma that it isn't regular? Can I use the concatenation closure and say that it's the language $L_1 = \{a^n\mid n\geq0\}$ and $L_2 =\{b^m c^m\mid m \geq0\}$ prove that $L_2$ isnt regular so $L_1 L_2 = S$ is not regular too?
I designed an algorithm like this but I do not know how to perform its analysis to determine how it runs $($$O(n)$, $O(n^2)$, $O(log(n)$, $etc$$)$ m = some constant for i = 1 to n { for j = 1 to m step 2 { // do some stuff here } m = m - 2 } Can you please provide a clue to solve my issue? This...
Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes: /* P1 */ while (true) { wants1 = true; while (wants2 == true); /* Critical Section */ wants1 = false; } /* Remainder section */ /* P2 */ while (true) { ...
I'm struggling to apply the theorems of natural deduction to these two examples. $$((p \to q) \land (p \to \neg q)) \to \neg p$$ $$((p \to q) \land (p \to r)) \to (p \to (q \land r))$$ Can anyone help? That is, soundness and/or completeness.
So, I have two problems: Minesweeper: given an undirected graph where some vertices have a whole number associated with them, check if there is a way to mark some of the non-numbered vertices such that the number in each numbered vertex is equal to the amount of its marked neighbours. Dominating set: given an undirect...
My reasoning is as follows. Every boolean formula can be expressed as a sum-of-products. Every sum-of-produts is a list of minterms. For each minterm, there is 1 combination of inputs that satisfy the formula. So if I have the sum-of-products representation of a boolean formula I can tell if it satisfiable. But that ...
It is quite direct to prove that $\lfloor{\sqrt{n}\rfloor} = O(\sqrt{n})$. But how can I prove that $\lfloor{\sqrt{n}\rfloor} = \Omega(\sqrt{n})$?
I am aware the convex hull algorithm known as Graham Scan can be computed by sorting the derived vectors from points given in a 2D plane. One then iterates through a series of Cross Product calculations to find the determinant of a pair of vectors derived from the sequence of given points. This determine whether to mov...
Let $S(i,x_1,\ldots, x_n)$ be a primitive recursive predicate. \begin{equation} f(i_1,i_2,x_1,\ldots, x_n) = \begin{cases} 1 &\text{ when for all i, }\; i_1 \le i \le i_2,\; S(i,x_1, \ldots, x_n)=1\\ 0 &\text{ otherwise} \end{cases} \end{equation} Show that $f(i_1,i_2,x_1,\ldots, x_n)$ is also primitive recurs...
Given two large directed graphs (may have loops and lonely nodes) A and B. They are structurally similar. If we give a node in Graph A, how to find the corresponding one in Graph B? Finally, we need to find all the node mappings. Of course, there can be more than one possible mapping. We need to find the similarity (ra...
I think I can run Dijkstra's algorithm using any data structure. I do not see any implementation details of Dijkstra's algorithm. Is a priority queue a possible data structure? Will running Dijkstra's algorithm using a priority queue reduce or increase the complexity? Will I overshoot the problem?
As I understand, evaluating something like the following in normal order evaluation is inefficient due to duplicate work: double x = (x,x) main = double some_hard_computation I remember someone telling me That there are two ways to avoid this: strictness analysis (to recognise that double is strict in its one arg...
BFS and DFS can be achieved in O(|V| + |E|). I understand the proof but it seems a bit lengthy. Can I argue O(|V| + |E|) in a very simply way? e.g. checking each edge at most once? Also what does O(|V| + |E|) imply? I know Dijstrka algorithm and many other algorithm is somewhat like BFS. Does it imply automatically...
Background: I have a dependency graph, i.e. a directed graph where the nodes are tasks and the edges are dependency relations. Moreover, nodes are assigned a weight since they take different amount of time to complete. I have developed an algorithm that rearranges the graph by merging some nodes together that can be c...
I was reading about the $\mathcal{O}(\frac{1}{\log n})$ approximation algorithm for the Unique Coverage Problem from these notes. The gist of the algorithm is as follows: Partition the elements into $\log n$ classes according to their degrees, i.e., the number of sets that cover the element. So class $i$ contains all...
Given the values of $n, k, m$, you have to check if there are $m$ distinct numbers in the range from 1 to $k$ have the sum $n$ or not ? $n$ represents the required sum $k$ represents numbers range(1,2,3,... to k). $m$ is the number of elements in the range from 1 to $k$ that has the sum $n$. Example: n = 12, k = 8, m =...
Question: Given an array of positive integers and a target total of X, find if there exists a contiguous subarray with sum = X E.g: If array is [1, 3, 5, 18] and X = 8 Output: True, if X = 10, output is FALSE. Approach I can think of is to expand sub-array window, until you hit an index such that sum of sub-array ==...
In the amortized analysis of Splaying in Dynamic trees, let us consider a splay tree $T$ with $n$ keys and $v$ be a node of $T$. We define $size(v)$ as the number of nodes in the subtree rooted at $v$. The size of an internal node is one more than the sum of sizes of its two children. So, the root $T$ has a maximum ...
In order for the BIOS code to matter, it must be evaluated by the processor. However, the processor itself needs to do work to actually get access to the BIOS code, since the CPU only performs instructions that are given, something must give the instructions to the CPU (since I can't imagine a way for instructions to j...
I know 15s complement subtraction may not be much taught/popular one, but I just want to give it a try. Just trying to clear my basic digital logic/number systems concepts. Here is what I am doing: Normal decimal subtraction $(339)_{10}-(401)_{10}=(-62)_{10}$ 1's complement subtraction $(101010011)_2-(110010001)_2=(10...
I am facing a hard time understanding Blocking Flow problem. This is what I have understood till now : We have a graph and in blocking flow problem we find all shortest paths from source to destination and saturate atleast one edge in all of the shortest paths respectively [1] and we delete that path. In examples I am ...
I am reading article https://arxiv.org/pdf/cs/0511055v1.pdf (about defeasible deontic logic) and it mentions on page 10 the operator T that constructs extension (set of immediate consequences) from the theory D (set of statements). Such extensions form s.c. Kleene sequence and the fixed point exists for the operator T ...
Is there an example of a language that is neither recognizable nor co-recognizable? A relevant (easy) theorem is that a language is decidable iff it is recognizable and co-recognizable. An example of an undecidable language is the set "acceptance problem," i.e. the set of strings (Turing Machine = M, string = s) such t...
Lexical Analyzer mostly deletes comments and white-spaces. One example where I think Lexical Analyzer might not be discarding white-spaces is in Python language, as indentation has a important role in python. But I can't think of practical example where comments are/should be kept by Lexical Analyzer? Is there any such...
How do I prove that diameter of undirected Ring Topology is n/2?
How can I build a regular expression that, using only the concatenate, union and star operations, over the alphabet {0,1}, describes the language "Every three consecutive characters contain at least two 1, and the input has length at least 3"? For instance 110011, 0101 and 11 should be refused. I was thinking on using ...
I am currently studying the theory behind Well-Quasi-Orders. However I am having some issues in understanding how an infinite anti-chain can be produced to disprove the claim that a partial order $P$ is a w.q.o. In particular I am wondering whether it is logically sound to present as proof not the infinite anti-c...
I'm trying to teach myself about quantum computing, and I have a decent-ish understanding of linear algebra. I got through the NOT gate, which wasn't too bad, but then I got to the Hadamard gate. And I got stuck. Mainly because while I "understand" the manipulations, I don't understand what they really do or why you'd...
Given is an undirected and connected graph. The vertices are persons and the edges between them model their relation. Iff X and Y have an edge (X, Y) the know each other directly. Because the graph is connected each person knows each other at least indirectly. If X knows Z indirectly there must be a person Y so that X ...
So, I'm trying to do a computer architecture assignment and there's a question about dcaches. Here's the question: Given a 16 word dcache initially filled with word address 0, 1, 2, …15 memory data (referenced by the datapath in that order). Below is the next sequence of data memory address references given as wor...
As I was watching a video about single qubit quantum gates, I came across the following gate: $$\begin{bmatrix}e^{i\sigma}&0\\0&e^{i\theta}\end{bmatrix}$$ The video didn't mention the name of the gate. It gave only the matrix and the following information: $|0\rangle \rightarrow e^{i\sigma}|0\rangle$ $|1\rangle \right...
For the following code sample: int f(int n) { if (n <= 0) { return 1; } return f(n - 1) + f(n - 1) } I understand that the time complexity is $O(2^N)$. However, what I don't understand is how the space complexity is $O(N)$. The argument I have heard for this is that although we have $O(2^N)$ nodes ...
Question: Suppose you are a given a csv with N lines of the form StudentID, score. Multiple lines can have same student-ID. Find the student with maximum average score I can't think of any way to make it faster than O(N*logN). Maintain a hash-table that keeps track of STudentID = Key and Value being an object wit...
I am familiar with operational semantics (both small-step and big-step) for defining programming languages. I'm interested in learning denotational semantics as well, but I'm not sure if it will be worth the effort. Will I just be learning the same material from a different point of view, or are there insights I can on...
I'm trying to solve the Mountain Car task on OpenAI Gym (reach the top in 110 steps or less, having a maximum of 200 steps per episode) using linear Q-learning (the algorithm in figure 11.16, except using maxQ at s' instead of the actual a', as required by Q-learning; I've solved it with other methods easily, the quest...