instruction
stringlengths
35
29.1k
What are the implications of a non-blank character being over-written by a Turing machine M for the given input variable 'x'? Intention of the question: I am trying to answer how the halting problem can be made decidable provided we have a TM which can say whether 'M' overwrites a non-blank character by Blank or n...
A Bloom filter is a space-efficient probabilistic data structure to perform membership-tests on a set (see Wikipedia's page for a definition; I use the same notations below). I am interested in a special application where the number of bits per element $m/n$ is very low, with typically $m<n$ (this results in a very com...
With LL grammars, there seems to be a very intuitive explanation, in terms of first and follow tables.( The first letter/s encountered in a particular state, can only mean a particular rule). With LR grammars however such an explanation seems to be difficult. Of course you could go through the entire construction of th...
I have written some code that animates two boxes using HTML5 and JavaScript threads. I set them up to move at a fixed rate, which is the same: executeEvery(box1.animate(), 10); executeEvery(box2.animate(), 10); The result is weird for reasons not important here. This to me seems to be the two executeEvery calls not wo...
Why does Bresenham's line algorithm eliminate dy/dx division and the multiplication of that (potentially floating point) number?
I thought about the following problem: There are goods $\mathbb{G} = (g_1, \dots, g_k)$ on the line. Coordinates are expressed in meters and sorted in increasing order. All goods have different storage life $\mathbb{S} = (s_1, \dots, s_k)$ expressed in seconds. Restrictions on the data: $k < 1000, |g_i| < 10^7, |s_i| ...
What does $\log^{O(1)}n$ mean? I am aware of big-O notation, but this notation makes no sense to me. I can't find anything about it either, because there is no way a search engine interprets this correctly. For a bit of context, the sentence where I found it reads "[...] we call a function [efficient] if it uses $O(\lo...
in these days I'm doing research about the history of the mailing lists. Someone can suggest me interesting "Papers" or Article on the web in order to learn much about history and principal use of this service?
The Toffoli gate takes in three inputs and gives out three outputs, and is often referred to as the quantum AND gate. It takes in a,b,c and gives out a, b, c XOR (a AND b). Why does it do that, instead of just giving out a,b,b AND c? or a,b,(a AND b)?
With 2 qubits, there are 4 ways to entangle the qubits - the four maximally entangled two-qubit Bell states, of which one is $1/\sqrt{2}(|00\rangle + |11\rangle)$. Is it possible to entangle more than two qubits together? If so, is there any practical use to doing so?
I'm reading up on System Z introduced by Judea Pearl (in System Z: a natural ordering of defaults with tractable applications to nonmonotonic reasoning). A central definition is that of tolerance of a subset $R'$ of a rule set $R$ for a rule $r = \alpha_r\to\beta_r$ (denoted by $T(r\ \vert\ R')$). Tolerance of $R'$ for...
I'm looking for a paper that discusses the maximising of one colour in a vertex colouring. Suppose that for an unweighted, undirected graph $G=(V,E)$ we define a vertex colouring as a function $c : V\to\mathbb N$ (where we use $\mathbb N$ for the colours). I would then like to maximise $\#\{v\in V\mid c(v)=n\}$ for par...
The original statement referred to by this question is: The more I ponder the principles of language design, and the techniques which put them into practice, the more is my amazement and admiration of ALGOL 60. Here is a language so far ahead of its time, that it was not only an improvement on its predecessors, but al...
I'm looking for interesting open questions in complexity theory that someone with an undergraduate degree in math and comp/sci could theoretically tackle. I have strong interest in the polynomial hierarchy, and the study of probabilistic classes like RP, co-RP, ZPP, BPP, and also their logarithmic counterparts. I also ...
For example, for the language $L = \{a^nb^m|n \neq m\}$, why does it have infinitely many equivalence classes? How do I show/see that?
I heard once that you could translate any digital circuit into a modulus operation, perhaps modulusing against different numbers? It was a long while ago though and don't remember where I heard it. Is this true or does it ring any bells?
I'm looking for an explanation or reference on the implementation of computer clock. To keep the question at the level of logical abstractions: say, we put together some combinational and sequential logic from basic gates. The role of the clock (an oscillator of some sort, but that's going into more detail than needed ...
If so, I cannot find any examples of this. Edit: By "used", I mean are they still used in rendering in games or whatever. I haven't seen it used anywhere except in MS Paint because Wu's algorithm looks way better (yet is still not expensive as far as I know).
According to CLRS the master method requires the recurrence to be of form $T(n) = aT(n/b) + f(n)$ where $a \ge 1 $ and $b > 1$ are constants and $f(n)$ is asymptotically positive. This makes it sound like even $a \not\in \mathbb{Z}_+$ is a legitimate value of $a$ as long as $a \ge 1$. I have trouble visualising what ki...
Per recommendation I am reposting this from Stack Overflow. Recently I have been thinking about following issue. Consider the code for a standard "Hello world!" program: main() { printf("Hello World"); } Now almost any change in this code will make it completely useless, in fact almost every change will prevent t...
The original statement for this problem can be found here This is a question from IEEExtream 2014. There is an array of integers given. Input is X, so output is the number of subsets where there GCD equals to X. Eg: OriginalSet = {2, 3, 5, 6, 6} numberOfSubsets(2) => 3 // there are 3 subsets where their GCD equals to ...
Let $G'_{m,n}=(V,E)$ be the grid graph $G_{m,n}$, to which we add "diagonal" edges. For example, here is $G'_{6,3}$: And for each vertex $v_i \in V$, we have a associated positive value $c_i$ Consider the following algorithmic task: Input: $m,n,\{c_i\}_{v_i\in V}$ (in unary) Output: The minimum weighted vertex cover ...
I was reading Data Communication book by Forouzan in which there is a one restriction put on CIDR subnetting by Internet authorities: First IP address in the block should be evenly divisible by the number of addresses. For example, below, the first address, when converted to a decimal number, is 3440387360, which when...
What does x-bit binary number mean? for example: if x = 8 is 8-bit means: any number consists of 8 bits, like : 10101110 or it has another meaning??
Which calculus is based on first-order functions and is Turing complete? I know of calculi which are Turing complete, but based on higher-order functions: Lambda calculus SKI combinator calculus There is also a calculus based on first-order functions, but is not Turing complete: Kappa calculus I know that first-ord...
If $L_{1} \subseteq L_{2}$ and $ L_{2}$ is regular, does it follow that $L_{1}$ is necessarily regular? I don't understand this question, is there any proof to show this or is there an assumption we make?
This is the problem: $d_{T}(v)$ denotes the degree of a vertex in a spanning tree $T$ and $w: V \rightarrow R^+$ is a weight function defined on vertices. The goal is an algorithm that finds a spanning tree which minimizes the value $\sum_{v \in V}{d_{T}(v)*w(v)}$. My idea is to define a new weight function on edges i...
Physics is defined as the study of an object {matter or energy} with its interaction with other objects: Physics is the study of matter, energy, and the interaction between them. On the other hand, Digital physics is based on computations and information. Digital physics is a collection of theoretical perspectiv...
I was learning about Max Flow and Residual Graphs and was wondering if there was a formal proof for the statement: the flow value can increased along an augmenting path $p$ in a residual network I was reading the slides linked at the end of question and they seem to omit the most important part of the algorithm whi...
If we have: x = 1101 and y = 101 How to XORing these numbers?
Problem. To obtain a path from vertex s to vertex t whose minimum-weight edge must be the maximum one among the ones of all the paths from s to t. This path is just the bottle-neck path from s to t. The following is my algorithm for finding bottle-neck path by sub-ranges searching. Actually I just want to get the small...
I am studying the Zero Mean Normalized Cross Correlation (ZNCC) method for pattern matching. I would like to match the pattern of a square region of size $N \times N$ from two different images. Hence I define two vectors $P$ and $Q$, each of size $N \times N$, for storing the pixel intensity inside each of the two regi...
I was reading the following notes on maximum flow and it said the term "maximum-bottleneck (s-t)-path" but I couldn't find were it precisely defined it, so I am left guessing what it means. I am assuming it means a path from s to t with maximum total capacities once you sum the capacities across the path. However, I am...
We know that Turing machines and Lambda Calculus are equivalent in power. And There are proofs for that, I'm sure. But is there an algorithm, a systematic way for us to convert a Turing machine into a Lambda Calculus expression? Is it impossible to have such algorithm? (meaning does it go down to undecidability or NP-C...
I'm a computer engineer and I've met hash functions theoretically speaking in "algorithms and data structure" and then in several applications (like databases, operating systems, computer architecture etc). But I was wondering if there's some general theory about these functions and, specifically, if there's a general ...
In Kosaraju's Algorithm, using first dfs (traversing on reverse graph) we calculate finishing time of nodes, and then traverse (actual graph) in reverse order of finishing times. why not without reversing graph, using first dfs (traversing on actual graph) we calculate finishing time of nodes, and then traverse (actual...
In my previous question ( Can Turing machines be converted into equivalent Lambda Calculus expressions with a systematic approach? ), I got the answer that it is indeed possible. And as I have read before, every program written in all programming languages is convertible to a Turing Machine. And of course, since there ...
I am studying the proof of the following theorem: Given the language $\mathit{REGULAR}_\mathit{TM} = \{\langle M \rangle | M $ is a turing machine and $\mathit{Accept}(M)$ is regular$\}$ $\mathit{REGULAR}_\mathit{TM}$ is undecidable. The proof given in Sipser shows that if we already have a machine $R$ that decides $\...
I'm studying context free grammars and I can grasp how to create context free grammars given a set notation, and now to convert these context free grammars to Chomsky Normal form but I am utterly stumped on how to go past that and get to Greibach Normal Form, I am given the follow grammar which is already in Chomsky No...
Wikipedia says union by rank without path compression gives an amortized time complexity of $O(\log n)$, and that both union by rank and path compression gives an amortized time complexity of $O(\alpha(n))$ (where $\alpha$ is the inverse of the Ackerman function). However, it does not mention the running time of path ...
Is there a mutual exclusion or semaphore or locking algorithm that only relies on atomic reads and atomic writes of shared memory and can tolerate a delay in propagation of the written data between processes? I.e. if process A writes to shared memory, process B might not see the change for a while (but process A will s...
I'm trying to figure out a problem reported in Kleinberg (ch 6 no.16). I know that there are solutions based on ordering, anyway i'd like to understand if another way exists. Basically, we have a hierarchy of people represented by a tree. The root person has to postpone a picnic due to rain: in a first moment he calls ...
How to find all shortest paths between node 1 and N in a weighted undirected graph? There can be multiple edges between two nodes. I want to find all nodes that can be on a shortest path. For example: 10 11 1 2 1 1 3 1 3 4 2 4 5 1 5 6 1 5 10 2 1 7 1 7 8 3 7 9 2 9 10 2 8 10 1 The answer is 1 7 8 9 10 because there a...
How to approach to solve this question and the likes of it? Let $L$ be the set of strings $\langle M\rangle$ such that $M$ accepts all strings of even length and does not accept any strings of odd length. a) Is $L$ Turing-recognizable? Prove your answer. b) Is the complement of $L$ Turing-recognizable? Again prove y...
A system has 6 identical resources and $N$ processes competing for them. Each process can request at most two requests. Which one of the following values of $N$ could lead to a deadlock? 1 2 3 4 My attempt: Deadlock free condition is: $R \geq P(N-1)+1 ,$ Where R is total number of resources, P is the number of pr...
Is "flops" a reliable measure of deciding computational capacity? If we do matrix multiplication and matrix addition of the same size of matrix, do the flops remain the same? Referring to question https://stackoverflow.com/questions/329174/what-is-flop-s-and-is-it-a-good-measure-of-performance I am curious to know if ...
I'm having some thoughts and I'd like to have your opinion about it. Given a basic, normal instance of SMP (men-women, men choose), we define $\mu$ to be the set of all stable matches. Each member of $\mu$ consists of men-rank, which describes the satisfaction index of the men - which in this case the member with the h...
The questions is as follows with the answer: Q) Given the arrival and departure time of various trains in a station. Calculate the minimum number of platforms required such that no train has to wait for another train to vacate the platform. The question basically means calculate the maximum number of trains that would...
Good evening! I tried to model the Binomial theorem, that allows to expand any power of x + y into a sum of the form: $$(x+y)^n = {n \choose 0}x^n y^0 + {n \choose 1}x^{n-1}y^1 + {n \choose 2}x^{n-2}y^2 + \cdots + {n \choose n-1}x^1 y^{n-1} + {n \choose n}x^0 y^n$$ Then, tried to estimate the number of recursive calls ...
As defined by Wikipedia, (The Curry-Howard correspondence) is a generalization of a syntactic analogy between systems of formal logic and computational calculi that was first discovered by the American mathematician Haskell Curry and logician William Alvin Howard. Related to it is the λ-cube, which is a graphical rep...
I am trying to prove a theorem (title) given in a starred problem in Sipser's book. I have absolutely no idea how I would go about showing it, and after trying a few different approaches came here looking for a hint. I don't want a full answer, but would really appreciate a few words to point me in the right direction....
The data structure is used for example in Scala: https://github.com/scala/scala/blob/v2.12.0-M3/src/library/scala/collection/concurrent/TrieMap.scala More details in this paper: http://lampwww.epfl.ch/~prokopec/ctries-snapshot.pdf The logic I'm confused about is on line 139 in Figure 11 on page 6 of ctries-snapshot.pdf...
I want to know how it can process spoken English words and Pull out a matching response? Is it a chip or a installed software? Does it take up a lot of space? Thanks.
The wikipedia page (here) assumes the existence of some $L \in \Sigma_4 - SIZE(n^k)$. How can one show that such a language exists? This is related to a homework question, I'd prefer some hint to the answer. Using the hierarchy theorems, we can find some language $L \in SIZE(n^{k+1})$ for which $L \not \in SIZE(n^k)$....
I am learning about artificial neural networks and I've decided to go with perceptrons. I already made a sample program that can learn based on the learning data, but when I tried to make it recognize the color green it stopped working. The learning data is based off of RGB values. So at first the perceptron was learn...
Let be $F=(A\land B)$ and $G=\neg(\neg A \lor \neg B)$. Which of the following statements are correct $F=G, F\equiv G, \neg F=\neg G, \neg F\equiv\neg G$? Is there a difference?
I have a homework assignment where I am supposed to make a visual representation of a deterministic FSM. Basically, the FSM is to accept the input string if it does not contain the letters a and c immediately after the other. The input alphabet I is I = {a, b, c}. As a hint, the class was told that 4 states would be en...
I have been reading the paper[1] in the title. But there are some parts of it that are unclear to me, more specifically the way you typecheck a lambda. I have attached the typing rules below as images[2] [3] Typing them all in Mathjax would have been a lot of work. I will explain the issue I am having by means of an ex...
Suppose that a DBMS recognizes increment as an atomic operation, in addition to the read and write operations. Let $V$ be the value of the data item $X$. The operation increment (X) by c sets the value of $X$ to $V + c$ in an atomic step. The value of $X$ is not available to the transaction unless the latter executes...
So, I have the following propositional formula: (((P → Q) ∨ S) ↔ T) How do I decide if it's well formed?
Firstly, I would like to apologize if I misplaced this topic / i think the theory of coding is close to CS / I am little bit confused right now, in the school we were learning about Hamming's code, Block codes etc. I was given a homework, in which I should explain how does the two dimensional parity check finds 3-bit e...
If $L$ is the set of strings $\langle M\rangle$ such that $M$ accepts all strings of even length and does not accept any strings of odd length. What will be $\overline L$ ? a) set of strings $\langle M\rangle$ such that $M$ accepts all strings of even length as well as any strings of odd length. b) set of strings $\la...
I want to work on automatic grammar correction using machine learning (possibly using recurrent or deep neural networks). The algorithm will be supplied with both corrected and initial documents for supervised learning. I am now looking for some survey or research papers to start with. I have searched and downloaded te...
I'm trying to write an algorithm to compute a minimum size dominating set of an undirected graph G(V,E). I think the following works: 1) Sort vertices by number of edges (descending) 2) Add the first vertex to the set D (which will be the dominating set output) 3) Delete all vertices connected to D by one edge 4) Add ...
Let us consider the subset sum problem with $S = S_i = \{1,2,..,i\}$. There are of course $2^{|S|}$ different sums that can be formed. Now it seems that though the sums are not in order and thus not searchable efficiently there is some structure as indicated by the picture below. In the image there are the cases i = 1....
Is there a functional specification of alpha-beta search that makes it easy to prove by induction that the algorithm works?
I have a weighted, directed graph. I do the following. Given nodes $s$ and $t$ I compute shortest path. Then, I decrease weights of some edges and want to see if there is now another shortest path. Of course, I can recompute shortest path, but I want something faster. For example, one approach would be to store shortes...
An exercise problem stated that : Which of the following addressing modes permits relocation without any change whatsoever in the code? Indirect addressing Indexed addressing Base register addressing PC relative addressing Somewhere it explained as : Base register addressing : In this mode , content of base register...
Suppose we have language $a^{\binom{n}{k}} n,k \in N$ is this language regular ? If it is not, I should use pummping-lemma? It it is regular, I will use proof by induction ?
I'm converting hex ( in positional fractions) to decimal question : 0x3c.e8 my attempt: $3*16^1 + 12*16^0$ yields $60$ $ 3c$ = $ 60 $ in decimal so i know its 60. then $.e8 *10 $ (since I want base ten) = $232$ my question is do I just say 60.232?
Let's say I have a file with symbols of an alphabet [0,N-1], N around 50. The actual data is a file with a lot of lines, each containing 100 of these symbols. I want to compress this data. By doing a frequency analysis over a large amount of lines to build a probability density function and then calculate the entropy y...
We know CLIQUE and HALF-CLIQUE problems are NP-complete. Now consider the class of graphs (let's call it $\mathcal{G}_{2K}$) where a graph $G=(V,E)$ is a member of $\mathcal{G}_{2K}$ iff $G$ has two SEPARATE cliques $K_1$ and $K_2$ of size $\dfrac{N}{2}$ (where $|V| = N$). My speculation is that $\mathcal{G}_{2K}$ is i...
Is there an algorithm that performs the following: Input: A directed graph and two vertices within that graph Output: Whether one of the two vertices is the ancestor of the other For example, in this graph: A is an ancestor of D. B is neither the ancestor nor the descendant of C. The best I can think of doing is perfo...
(Using Haskell syntax, since the question is inspired by Haskell, but it applies to general Hindley-Milner polymorphic type systems, such as SML or Elm). If I have a type signature f :: a -> [a], what is the logical proposition encoded by that type signature? I know that type constructors like ->, (,) correspond to "op...
I was wondering, are there any famous algorithms in NLP or NLG that can take some text (say a news article online) and transform it to a lower reading level?
I am learning about compiler optimization technique and there is a technique that use associativity of addition to transform code. For example, consider the following expression: (a + b) + ((c + d) + e) It can be transformed into: a + (b + (c + (d + e))) Does anybody know the name of this transformation?
Are there any reasons to work with the DIMACS framework, such as to test algorithms, coding, and heuristics of TSP (Traveling Salesman Problem)? It is nearly 15 years since establishment of the benchmark in 2001.
I want to understand type theory but I have to know first how I can apply it. Could there be more non-obvious applications of type theory aside from in type systems in programming? Could there be other applications, let's say in personality profiling and the likes?
When we would like to prove lower bound comparison algorirthm, we often use decision tree, for example sorting by comparisons. So let's consider find minimum in array $a[1..n]$ by comparison. Lower bound for that problem is commonly known - $n-1$ comparisons. However, how to use decison tree in order to prove lower...
What is the time complexity of the following piece of code in worst case? s=0; for(i=1;i<=n;++i){ for(j=1;j<=i*i;j++){ for(k=1;k<=j and j%i==0;k++) /* k<=j and j%i==0 */ s++; } } Each loop depend on the outer loop variable.How to proceed in such case? Innermost loop will run only some...
I have read in my subject "Operating Systems" that CPU can't access secondary memory. Any program that is stored on secondary memory is executed once its retrieved from secondary memory to primary memory. Is this true? If the CPU can't execute code directly out of secondary memory, why not?
The Google Hash Code 2015 Test Round (problem statement) asked about the following problem: input: a grid $M$ with some marked squares, a threshold $T \in \mathbb{N}$, a maximal area $A \in \mathbb{N}$ output: the largest possible total area of a set of disjoint rectangles with integer coordinates in $M$ such that eac...
Suppose algorithm A is given for a maximization problem and we are asked to show that it is a 1/2-approximation algorithm. As you know it is enough to show Sol >= 1/2 OPT What I need to know is, is it true to assume this problem as a minimization one and prove Sol <= 2 OPT Or is there any correspondence between these ...
Is the language $\qquad L=\{ \langle \text{M} \rangle \; | \; \text{M is a Turing machine that decides some language} \}$ a Turing-recognizable language? I think it's not, as, even if I am able to tell somehow that a Turing machine halts for some input there are still infinite strings to check for. Similarly I think...
Suppose I have 100 qubits that I want to entangle and put into superposition. To do so I construct a Hadamard gate to do this. By definition, the Hadamard is going to be a 2^100 X 2^100 matrix - which is huge. How does one go about actually performing this operation? The size of the Hadamard matrix is exponential relat...
When a local variable is reassigned a different value/object, does its position/address change in the stack?
INPUT: directed non negative weighted graph, s, t, k OUTPUT: SSSP from s to t where the path has $\leq k$ vertices MY PROGRESS: heap.add(s,0) where s is vertex and 0 is weight and heap is minheap depth[s] = 1; do c = heap.poll(); SSSP[c] = c.weight if(depth[c] >= k) continue loop; for v in c's adjacent vertices...
Given a monotone polygon, with it's vertices given in counter-clockwise orientation, is there any fast process to determine whether the line between two vertices of that polygon A and B is a valid diagonal of that polygon? A valid diagonal is a line between those two vertices that lies inside the polygon and doesn't in...
I have a problem that is similar to this that I am trying to solve: "Given a randomly-shaped field, what is the best (fastest I guess) way to plow it? Every part of the field must be plowed, plowing outside the area is not a problem, and turning around is slower than going straight." Basically, I'm in the situation of ...
I'm stuck with one of my homework exercises: Consider the following variant of Karger’s algorithm for finding a minimum s-t cut, i.e., a minimum cut separating two specific given nodes s and t: As in the original algorithm, edges are iteratively contracted. In any iteration, let s and t denote the possibly contracted ...
What would be the general approach for that? And what are the things that generally overlooked while proving such things? For example, I have a Language, L ={e:$L(M_e)$ such that it accepts only 'a where a$\in \sum^{*}$}? Is it possible, 1. To prove its not a CE, Can we reduce $(Acceptance\space problem)^{complement}$ ...
I was recently going through the Wiki page List of unsolved Problems in Computer Science. There was a problem which I do not understand Do one-way functions exist ? [Is public-key cryptography possible ?] A one-way function is a function that is easy to compute on every input, but hard to invert given the image of a ...
I started reading about timed automata lately. In the definition, they have locations instead of states as in automata theory. Can anyone explain why is this?
Bucket sort is a linear-time sort. Why do we use insertion sort in it? We know that insertion sort takes $O(n^2)$ time. Why can we not use any linear sort inside it? As we see, when in each bucket we use insertion sort $O(n^2)$. How is bucket sort's total complexity $O(n)$? Why do we not use a $O(n \log n)$ sort such...
A while ago, I was doing my laundry late at night. When I brought my laundry back to my dorm, I started to put it away. My wardrobe is set up as follows: My drawers are categorized by the type of clothing they hold, and I'm very particular about that; this means I can't put t-shirts in my pants drawer (otherwise I'll...
How could I express an AND gate using only XOR gates ?
I want to covert this DFA to RE: I converted and this is my result: 1*+1*2+21*, but I test it and give wrong result. This dfa describe "any strings(lambda) but not contain 22". Please help me about!
I'm wondering, is showing two different ways to derive the same word enough proof to show that a context-free grammar is ambiguous? For example: O = start symbol Non-terminal = {O} Terminal = {r, s} Productions = O -> r O -> Or O -> sOO O -> OOs O -> OsO There are two different derivations f...
After reading this blog about Deep Neural Networks learning about selfies I'm struck by how generic the network in question is. In short: I'm thinking of trying to write something vaguely similar for solving cryptic crosswords, but I can't fathom how to make the general algorithms it uses generic enough that it can dev...
Let $\mathbb{X} = \mathbb{N} \cap [0, 255]$. I am given three vectors in $\mathbb{X}^3$ which I will denote by $v_i = [x_i, y_i, z_i]^T$ for $i \in \{1, 2, 3\}$. Now we have a binary operator $\bigoplus$ defined by $w = u \bigoplus v = \lfloor0.9 \cdot u\rfloor + \lfloor0.1 \cdot v\rfloor$, where $u$ and $v$ are in $\m...