instruction
stringlengths
35
29.1k
I'm trying to understand IEEE 754 floating point. when I try convert 0.3 from decimal to binary with online calculator, it said the significand value was 1.2 Where 1.2 come from? I did understand another bits like exponent and sign bit. .3 if converted to binary it will be .3 * 2 = .6 + 0 .6 * 2 = .2 + 1 .2 * 2 = .4 + ...
The Wikipedia explanation is clear to convert unsigned integer binary format into Binary Coded Decimal. The double-dabble algorithm is trying separate binary digit to BCD for example: Given 4-bit input 1101 (13 in decimal) will produce 0001 0011 The input from example clearly is unsigned integer, but how about IEEE754 ...
I got an exercise about a variation of RB trees but I am struggling to see how to solve it, therefore I'll be happy to hear your opinion about it. The exercise is: Let us define a binary search tree which we will call Red-Red-Black tree if it satisfies the following: Every node is either red or black. Every leaf (NIL...
Show that P and NP are closed under Kleene star. I found possible solutions to these problems, more specifically: P - finding all subwords from a giving word and looking if there is a connection between them (idea: https://louis.jachiet.com/lfcc/final_solutions.pdf) NP - non-deterministically dividing word for m subwo...
Let $C$ be a regular language. Prove that the language $D = \{x x^R : x\in C\}$ is context-free. It's clearly important that $C$ is regular; if the hypothesis were weakened to C being context-free, then we would have the counterexample $C = \{0^n 1^n : n\ge 0\}, D = \{0^n 1^{2n} 0^n:n\ge0\},$ which isn't context-free...
Let $A$ be an array of numbers. Let $y$ be positive. We want to find two numbers $A[i]$ and $A[j]$ such that their absolute difference is at most $y$.
In articles or Quora posts about category theory, I often find mentions of the programming language Haskell. I have little knowledge of category theory and even less of programming. Could someone please explain how category theory is important in Haskell?
I wonder if we take the current state of our machine as input, is it possible to generate a function to estimate the future state? Of course I mean like we get the 10 minutes after status within 1 minute of computing. Is it a possible things? If not, then why is it impossible? I know it's quite a weird question. : ) Th...
I have found that a problem that I'm analyzing is equivalent to the following variant of the Exact Cover problem: Partition into $k$ Exact Covers Input: A universe $U$ and a family $C\subseteq 2^U$ of subsets of $U$ in which each element $x\in U$ occurs in exactly $k$ subsets of $C$. Question: Can the family $C$ be pa...
I am trying to solve T(n) = 4*T(n/4) + n*[log(n)]^2 I decided to use Master Theorem so I found a,b=4 and logb(a)=1. I thought that 3rd case is the solution but I don't know actually how to solve this. Any help appreciated. Thanks in advance !
Task: Input: DFA $M = (Z, Σ, δ, q_S, E)$ $T(M)$ := Language that $M$ accepts. Question: Does $T(M)$ contain at least one word $w$ such that $|w| = n^2$ with $n \in \mathbb{N}$$ ?$ My attempt: Since the language $\{w\in Σ^* \mid |w| = n^2 \} $is not regular. You cannot create DFA $M'$ which accepts this language and use...
Assuming we have a DAG, $G = (V, E)$, and we know that we can calculate $G$'s transitive closure in time complexity of $f(|V|, |E|)$, whereas $f$ is monotonic increasing function. Show that given a directed graph (not necessarily DAG) $G^{'}$, we can calculate it's transitive closure, $G^{+}=(V, E^{+})$, in time comple...
Given a list of positive integers with sum $s$, decide if there is a subset with sum $0.5s$. This is the well-known PARTITION problem, which is NP-hard. What about the following: Given a list of positive integers with sum $s$, decide if there is a subset with sum in the range $[0.49s, 0.51s]$. Can this problem be solve...
Is there any cellular automaton on the Eisenstein integers? By this I mean that the triangles formed by the Eisenstein integers are considered as cells and each triangle has three neighbours plus itself. I programmed in python such a cellular automaton and am curious what properties it has. git: https://gist.github.com...
Is there a notation for statements like the following: If both operands are of type int, then the result is of type int. If either operand is of type float, then the result is of type float. e.g. for the first case, can I say something like: $$int \ \text{op} \ int \rightarrow int$$ where $\text{op}$ is an operator w...
Problem: In this problem, we discuss Data-Structures that maintain a group of ordered elements. We must support the operations $ DecreaseKey, FindMin, Insert $ in time $ O(1) $ and the operation $ DeleteMin $ in time $ O(\log n) $. All the time-complexities are Amortized. We'll remind that so far, Fibonacci Heaps answe...
The latest development in solving the max-flow problem promises a ${\displaystyle O(E^{1+o(1)}\log U)}$ solution. What does it mean, this $O(n^{1+o(1)})$-complexity?
We say that if an algorithm takes p time for an input size of n (here, p is a polynomial in n, and the degree of p is y), then the algorithm's complexity is O(n^y). In the image, when n is very large it does not seem to matter much if it's x^2 or 2x^2. but, it clearly seems to matter if it's x or 2x. So, then why do we...
I have a straightforward task that can be done in $O(n^2)$ time. I'm now wondering if the task can be done in time $O(n^{2-\epsilon})$ if we are allowed to do some pre-processing. The problem exists of two steps. In the first (preprocessing) step, we are given an $n \times n$ array $A_{i,j}$: $n$ permutations of the nu...
Prove that the following language is context-free by giving a context-free grammar that generates the language: $A = \{a \in \{0,1\}^* : \text{ no character in an even position is a 0 or no character in an odd position is a 1}\}$, where the first position is position 1. For instance, $01110, 01010$ are both in $A.$ I...
I was looking for implementations of counting sort and most of them are implemented with cumulative counts like this: public void SortArray1(int[] nums) { var output = new int[nums.Length]; var count = new int[nums.Max() + 1]; foreach (var num in nums) count[num]++; for...
I am trying to solve one of the sample test problems in which I have to write an expression/pattern for the following language: $\{w \in \{0, 1, 2\}^*: {\#}_{0}(w) ∗ {\#}_{1}(w) \text{ is even}\}$ I was thinking about the approach of getting all strings with even number of 0s and 1s first and then make a complement of...
So, I have been looking into the famous back tracking problem called N Queens. The problem is essentially finding the number of possible ways you can place a n number of queens on a n x n chess board such that all of the queens are not in any other attack positions from other queens on the board. I came across the foll...
If I have a CFL, can I define a regular substitution to make it a RL? For example, if I have the language $\{a^nb^n \mid n\ge0\}:$ Define $h(a)=a$ , $h(b)=b$, then $h(L)={a^*}$ , am I right? Thanks!
Recently, I had to implement the following algorithm (similarly). Code in Kotlin: fun solution(keyword: String, lyric: String): Boolean { val lyricWords = music.split(" ") var index = 0 for (word in lyricWords) { for (c in word) { if (c == keyword[index]) { i...
How can i derive this Hoare Tripel? {false} x := x + 1; {x = 0} I do not know which rule should i use on this. I am confused on this wrong precondition.
I'm trying to solve the following exercise: Given this is true: \begin{align} \neg \forall x \space \ \exists y \ ( x\neq y \rightarrow LeftOf(x,y) )\end{align} Demonstrate : \begin{align} \exists y \ \forall x (x = y \ \ \lor \ \ RightOf(y,x) ) \end{align} With LeftOf and RightOf defined as: \begin{align}I(LeftOf) = ...
I work in the Computer Graphics field, and I have a problem where I need to find the optimal solution for, but I'm not sure how to best formulate the problem mathematically, how to define the objective function, and finally - how best to find that optimal solution. My problem is as follows: I have a 3D scene, and in it...
Let me cross post my question from math.stackexchange, since I feel this community is more related to the field. Title is self explanatory. I want to know is the language $L = \{xcy \,| \,x,y\in \{a,b,c\}^\star, |x|_a = |y|_b \}$ is context-free. I tried to prove that is not context-free using a proof by contradiction....
Say I want to solve a set of problems. I know that I can map my problem as a problem that is known to be hard in the general case (say, inference in Bayesian networks). But my set only contains instances which will map to easy instances - (say, having a tree-structure when cast to a BN inference problem) I know BNs wit...
I saw this image only, and it got me thinking: is this the maximum area difference between a contiguous region and Los Angeles County, such that the population of that region is smaller? Formally, given a graph with nodes $i$ from $0$ to $n$, where $i = (p_i, a_i)$, with $p_i$ represent its population and $a_i$ its are...
Does there exist a general approach in mainstream academia for representing a deterministic infinite automata? Unlike the finite kind, this one with infinite number of states. Although there is infinite state. There is a finite number of types of states. E.g. state $inBrackets_k$ goes to state has an edge leading to $i...
This started with me trying to make a regex to accept Bitcoin addresses. However, I couldn't do it. That led me to think: "is the set of all possible Bitcoin addresses even a regular language"? For simplicity, consider only "legacy" P2PKH Bitcoin addresses: a valid address consists of the character "1" followed by 25 t...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it, mostly because of the 0-weighted items. These are the rules: I have k finite sets of items. Each item has a weight and a value. I must take exactly one item from each s...
The IEEE 754 standard for floating point numbers defines a flag that is set when a result from floating point calculation isn't exact, i.e. has to be rounded. What algorithms are there that utilize that information?
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\log_2(n) + 3 = \mathcal{O}(n\log(n))$ So basically ...
I want to prove that, $$ \log n! \in O(n \log n) \land \log n! \in \Omega(n \log n)$$ The straightforward approach is to apply Stirling's formula but I am looking for a different path to follow. Can somebody please guide me towards it?
relatively new to Computer Vision. Lets say for example, I have a sequence of images of a car driving away from a static camera into the horizon, and I want to use this image set for some bog standard computer vision experimentation (e.g to train a CNN to recognize a car). I label the car in each frame with a rectangul...
I'm working my way through parts of Russell and Norvig's AIMA book for a class, and there's something I've never quite managed to wrap my head around. Chapters 3 and 4 contrast 'search' methods with 'local search' optimization methods, suggesting to me that there is some kind of fundamental difference between the two. ...
Can you help me find the theta complexity for lg(n^(1/2))?
Let $L$ be a regular language. Define: $half(L)=\{x|xy\in L,|x|=|y|\}$ Prove that $half(L)$ is regular as well. I have seen a hard proof by using the DFA A of L, building a NFA B (such that every transition from the stating state to the next one with the word $x$ will exist iff $\exists y$ s.t $|x|=|y| , \delta_A(q,y)\...
I saw a question on an old exam in my university course of DSA and I am not sure if the question is far too easy or if I am missing something. The question is : Given an array A that consists of N integers such that for any $1 < i \leq N$ the following properties holds : $| A[i] - A[i-1] | \leq 1$ $ A[N] > A[1] $ G...
What is the difference between time complexity of SLR(k) and SLR(1)? and also what about LALR(k) and LALR(1)? How can I calculate time complexity of parsers? I think time complexity of LR(k) is O(n) but I'm not sure there is a relation between LR(k) and SLR(k) or LALR(k)!
Prove/disprove the following claim: If $L\in RL$ then $\{x~|~\exists y ~~s.t~~ xyx^R \in L\} \in RL$ I think that this is true, and my intuition is by using $L_{pq}$ s.t: For every $(p,q)\in Q\times Q$ define $L_{pq}=\{w|\delta'(p,w)=q\}$. Then by using $L_{pq}○L_{q,q'}○(L_{pq})^R$ and taking the union of all possible ...
I have to find a CFG for the given expression: $L = \{a^wb^xc^yd^z | w + x = y + z\}$ This is what I've tried so far: S -> aSd | B | ϵ B -> bBc | ϵ It works for expressions like: aabcdd, abbbcccd However, using my grammar I wouldn'd be able to generate strings like: aaaacddd, abbddd, which, I assume, the language L sh...
The question is: There are 219 matches on a table and 2 players , each player can take 1,3 or 4 matches off the table , winner is who takes the last match. is there a winning strategy that guarantees for the second player to always win? . I can't think of a way to calculate without having to do the recursion myself , n...
I am solving basic questions about Recursive and Recursively-Enumerable languages. I know that base on the below theorem, to prove that a language is RE we should define an Enumeration Procedure for it. A language is recursively enumerable if and only if there is an enumeration procedure for it. And for the below que...
Suppose o is a map on strings to strings. For every language R, we let $o(R) := \{o(x) : x \in R\}$. If o(R) is a regular language for every regular language R, then prove or disprove that the language $\{xc o(x) :x \in A\}$ is context-free, where A is a regular language and c is a symbol not in the alphabet of A, $\S...
Suppose $x$ is Godel's number of some formula. Predicate $\operatorname{P}(\operatorname{f}(x))$ is true only when the number of functions is equal to the number of predicates in that formula. Prove that $\operatorname{P}(\operatorname{f}(x))$ is primitive recursive. My Godel Numbering system is $$G(\forall)=1$$ $$G(()...
Consider a DFA $A$ and $k\geq 0$. For states $q$ and $p$ of $A$, we say that $p\equiv_k q$ when $p$ and $q$ agree on all words of length at most $k$; that is, $p\equiv_k q$ when for all words $w$ of length at most $k$, it holds that $p$ has an accepting run on $w$ iff $q$ has an accepting run on $w$. Then, we say that ...
Let $w$ and $x$ be two binary strings. Show that the Hamming distance of $wx$ and $xw$ cannot be 1. I think one approach is a proof by contradiction. I was thinking of explicitly writing out $w = w_1\cdots w_k$ and $x = x_1\cdots x_n$, and proceeding with a case-based argument. Let $i$ be the unique index where the s...
For two equal-length binary strings $x$ and $y$, let $d(x,y)$ denote the Hamming distance. Prove or disprove: there exists a positive integer $k$ such that the language $\{x2y : |x| = |y|, x\in A, y\in\{0,1\}^*,d(x,y) = k\}$ is context-free for some infinite regular language $A$ over the alphabet $\{0,1\}$.   I think...
Is there a non-context free language A over the alphabet $\{0,1\}$ such that $A1 := \{a1 : a\in A\}$ is context free? I was thinking of the language $A = \{0^n 1^{n-1} : n > 0\}.$ Unfortunately, this language is context-free. I’m not sure if one might be able to show that context-free languages are closed under the o...
I am studying the book "Parametrized Algorithms" and it suggests a bounded search tree algorithm for k-Vertex Cover. Basically we look at a vertex v and say : Either v will cover it's incident edges or it has to be it's neighbors $N(V)$ so either $v$ or $N(v)$ will end up in the cover. That's 2 choices , we build a tre...
I came here to ask for help with a two-tape Turing machine for the following language. $L = \{ a^{n^2} | n \ge 0 \}$ I tried following the advice on this site: Turing machine that accepts L={an2|n≥1} [duplicate] because it was the one with the most answers, but I'm still not sure about the algorithm. If I understood it...
Integers between 0 and a square-free number $r$ minus one can be represented by their value modulo each of $r$'s prime factors, according the Chinese remainder theorem. Given a number represented like that, is there an efficient way to calculate its representation for $r^2$, that is, its remainder modulo each of $r$'s ...
Why is this language regular: $L=\{w~|~\#_a(w) \ge \#_b(w)\}○\{w~|~\#_a(w) \le \#_b(w)\}$? Where $\#_a(w)$ is defined as the number of $a$ in $w$. Isn't that a concatenation between 2 CFL? Thanks!
Boolean Satisfiability (CNF-SAT) problem in $n$ variables may contain a CNF formula with $O(2^n)$ clauses in the worst case. My question is: Wouldn't a program reading a CNF formula have to asymptotically run $O(2^n)$ steps? Is the search for a sub-exponential CNF-SAT algorithm moot?
I know that interface means a point where any two things meet and interact, but I can't seem to wrap my head around the term when they use it in computers. A chipset performs interface and peripheral functions for the processor. What does it mean? What do you mean when you say the chipsets are the circuitry that provid...
I am implementing A No-Reference Perceptual Blur Metric paper. Somewhere in the prep steps they mention the use of vertical Sobel filter for finding vertical edges. The algorithm is summarized in Fig. 1. First we apply an edge detector (e.g. vertical Sobel filter) in order to find vertical edges in the image. We then ...
I was studying Turing languages for an exam and I came up with this problem for wich I haven't found a solution online. This is my question: Let's say we have $L_1, L_2 \subseteq\{0,1\}^*$. $L_1$ is Turing-recognisable and $L_2$ is Turing-decidable. Is $L_u = L_1 \cup L_2$ decidable? Is it recognisable? My guess is t...
According to wikipedia, the Frontier supercomputer is the largest supercomputer in the world, at 1 exaFLOPS, and cost 600 million USD. I am quite surprised that the largest supercomputer only has 1 exaFLOPs, because of the following: The AMD Instinct MI250X has about 100 teraFLOPS, i.e. 0.1 petaFLOPS. Hence, if you s...
Most CV algorithms deal with 2D images produced by cameras. However, sometimes we need to process 3D “images” (I don’t know how to call them). For example, CT and MRI produce 3D radiographs. Traditionally these radiographs are cut into many slices for doctors to read. Because human eyes can only see 2D images (and most...
I have an array $a$ with $n$ elements, all of which have an associated weight. For example: $a = \{ (A,2), (B,5), (C,9), ..., (Z,1) \}$, such that element $A$ has weight $w_A=2$, element $B$ has weight $w_B=5$ and so on. The array is not necessarily sorted. Now, I would like to obtain a sample from this array where eac...
Assume I have a euclidean TSP solver that is optimal, but it can only solve inputs with exactly $N$ vertices. Let's call it the N-solver. Now, I have an input with $K$ vertices in the 2D plane, where $K < N$. Can I convert this $K$ sized input to an $N$ sized input where I can feed it into my N-solver and obtain an opt...
Definitions Define the density $\rho_L$ of a language $L$ to be a function $\rho_L : \mathbb{N} \rightarrow \mathbb{N}$ where $\rho_L(n)$ is the number of words in $L$ of length $n$. Question Let $L \subseteq \Sigma^*$ be a regular language with density $\rho_L(n) \leq b^n$ for some constant $b \in \mathbb{N}$ with $b ...
I am tasked to design a turing machine which calculates the function: $f(n) = 2n \iff 0 \le n \le 2$, or $4n+2 \iff n>2$ Where "n" is given in binary. Now, I'm not in the slightest way sure how to do this. This is what I came up with so far: I tried checking if a binary number is bigger than two. First, I thought that ...
I'm just starting to learn about representing numbers in sign-and-magnitude and two's complement, and both as signed binary integers two's complement if representing a negative number I should invert all bits and add one, while sign-and-magnitude represents negative numbers with the first bit as a sign bit, but is it p...
In actual industry use, does bottom-up provide a significant speed-up compared to an equivalent top-down approach to a dynamic programming algorithm? Assume that the top-down and bottom-up implementations both have the same asymptotic runtime. Do the constants really make a difference? Or does this all depend on the sp...
Let $A$ be an $n \times k$ matrix of real numbers. I'm looking for an exact algorithm to find a permutation of the rows of $A$, in such a way that the total number of inversions found in the resulting $k$ column vectors is minimal. That is, if $B$ is a row-wise permutation of $A$, I want to minimize: $$ L(B) = \sum _{j...
I want to show that the language $L=\{a^p ~|~ p\text{ is not prime}\}$ is not a CFL. If I look at $\bar{L}=\{a^p ~|~ p\text{ is prime}\}$, it is pretty straightforward to show that it is not a CFL with the pumping lemma, by choosing the word $w=a^p$, and with $w_{p+1}=a^{p+sp}=a^{p(1+s)}\notin L$ because $p(1+s)$ is no...
The statistical distance (SD) has been widely used as a 'measure' of the closeness of two distributions $D_1$ and $D_1$. Suppose that the statistical distance (here, total variation with $\ell_1$ norm) between distributions $D_1$ and $D_2$ is less than $s$. Then, as I know, there is a polynomial-time algorithm to disti...
Considering a function $f$ such that: $$ f(x_1, x_2, x_3) = f(f(x_1, x_2), x_3) = f(x_1, f(x_2, x_3)) $$ and $$ f(x_1, x_2) = f(x_2, x_1) $$ and a set $X = \{ x_1, \dots, x_n \}$; how to compute $$f(x_1, \dots, x_{i - 1}, x_{i + 1}, \dots, x_{j-1}, x_{j+1}, \dots, x_n)$$ for all pairs $i, j \in 1, \dots, n$, $i < j$ w...
Imagine you trained a text-from-image reader, similarly to the one described in this article https://medium.com/analytics-vidhya/image-text-recognition-738a368368f5 Now you want to port the trained network, or at least the bottom CNN layers, to process huge images (large photograph with tiny street name in the corner. ...
I'm struggling with the definitions of the push-down automata. In 2-DPDA and 3-DPDA, what do the numbers 2 and 3 stand for: for the number of stacks or of read-only tapes (and hence RO heads) ? Finally, is there a language accepted by k-DPDA but not with (k-1)-DPDA for any k ? It seems that the last question is unsolve...
Arora and Barak states (p. 230) the following: What is the relation between $BQP$ and $NP$? It seems that quantum computers only offer a quadratic speedup (using Grover’s search) on $NP$-complete problems. There are also oracle results showing that $NP$ problems require exponential time on quantum computers [BBBV97]. ...
Why is $L=\{w \mid ~|w|\bmod3=\#_a(w)\bmod3\}$ a regular language? $\#_a(w)$ is the number of $a$'s in $w$. So far every language that I saw containing modulo was a regular language. Can you give me an example of a non-regular language with a modulo operator in it?
I'm just trying to write a little algorithm. I've got nine objects, so there's 9! permutations. My question is, is there a way of turning a number from 1 to 9! into a permutation? for example, f(1)=[1,2,3,4,5,6,7,8,9], f(2)=[1,2,3,4,5,6,7,9,8] or something similar. Each number should have a unique ordering, and vice ve...
It is known that half-GCD (https://www.csd.uwo.ca/~mmorenom/CS424/Lectures/FastDivisionAndGcd.html/node6.html) is can be used to compute the GCD of two polynomials over a finite field. Is it possible to parallelize it? Or, are there any practical polynomial GCD algorithms that can run on clusters (like mpi, Hadoop)?
I was wondering about infinite closure properties. Are the Regular languages closed under infinite union? Infinite intersection? Probably not, by taking $\forall n>0~~L_n=\{a^nb^n\}\in RL$, then $\bigcup_{n=1}^{\infty}L_n=\{a^nb^n|n>0\}\notin RL$ By taking $L_k=\{a^ib^j~|~i\ne k ~~or~~ j\ne k\}\in RL$, then $\bigcap_{k...
I'm reading Douglas Thain's book called "Introduction to Compilers and Language Design" and I've come across the following grammar: , with the following LR(1) automaton: , and I am not sure the look-ahead sets in state 0 (or any other state, really) is computed. The algorithm given is the following: For an item like ...
Above is the proof of the pumping lemma for context-free languages, coming from the book 'Formal Languages and automata' by Peter Linz. The picture below is in support of the proof. I do not understand two things about this proof: 1) "we can assume that no variable repeats in the subtree T_5". Why should there not be...
Define $L'=\{u\#v^R ~|~ u,v \in L\}$ and $L\in RL$ while $\#\notin \Sigma$ Why is $L'$ a regular language? I have tried to construct the DFA of L, then with a # move to a copy of this DFA with flipped edges. I think this is correct. Thanks!
Above is a theorem coming from the book "Formal languages and automata" by Peter Linz concerning substitution of variables. Could someone explain why A and B have to be different variables?
I want to prove that $\mathcal M =\{a^ib^jc^k \mid \min(i,j)\le k\le\max(i,j)\}$ is not a CFL. Using the pumping lemma, let $p$ be the constant, then I choose $w=a^pb^pc^p$. When I separate to cases, looking at the homogeneous case, by choosing either $w_0$ or $w_2$ I can't disprove the lemma, because the number of $c$...
This blog posting states that "regular languages aren't structurally recursive" while "That's not the case for context-free grammars" In what sense is the term "structurally recursive" meant here?
Suppose we have finite field $\mathbb{F}_p$ with prime order $p$. Can we find polynomial in $\mathbb{F}_p[x]$ having given values $a_1, a_2, ... a_n$ at $x=1, 2, ..., n$ in less than $O(n^2)$ operations in $\mathbb{F}_p$? There is reference to general algorithm in another question which runs in $O(n \log^2 n)$ time, bu...
Let's determine if an expression is tautological or not and let's try this expression: ((a ⊼ b) ∨ c) ↔ (¬a ∨ ¬b ∨ c). We can turn this problem into CIRCUIT-SAT decision problem by asking if the expression ((a ⊼ b) ∨ c) ⊕ (¬a ∨ ¬b ∨ c) is satisfiable. Note that we repalced the universal gate with its inverse (by "univer...
I'm somewhat confused about the Wikipedia terms about the meaning of 'reversed' in the context of tree & graph treversals Suppose I have a tree: 1 / \ / \ / \ / \ 2 3 / \ / 4 5 6 / \ / \ 7 8 9 10 Tree traversal article describes...
I've been studying the examples of 3co-SAT recently. It's easy to find an example of one variable. $(x_1\lor x_1\lor x_1)\land (\overline{x_1}\lor \overline{x_1}\lor \overline{x_1})$ Examples of 2 variables are as follows. $(x_1\lor x_2\lor x_2)\land (x_1\lor \overline{x_2}\lor \overline{x_2})\land (\overline{x_1}\lor ...
Assume you know the Euclidean Minimum Spanning Tree of a set of $n$ 2D points (in general position). Is there an efficient way (faster than $O(n \log n)$ operations) to obtain the Delaunay triangulation of these points ?
As a software engineer, I am familiar with "domain-specific languages" (DSLs), such as PCRE and SQL, which aim to eschew complexity by only providing functionality specific to a given domain (e.g. string matching and database querying for PCRE and SQL, respectively). However, in some CSE literature I've seen the term "...
Could someone help me prove the following statement: “For any grammar in Greibach normal form, every sentence is obtainable by left-most derivations only.” I see that this is trivial, but I can't manage to start a formal proof of this statement. What I thought is: Since every derivation in Greibach Normal Form has a fo...
On calculating the convexity of an optimization problem, I am getting a term $O(\sqrt{n+m}(n)^3)$. Here both $m$ and $n$ are parameters. Is there any way I can simplify this term to write it as a product? I know that if time complexity $T(n,m)=O(\sqrt{n+m}(n)^3)$, then $\exists C,M $ such that $\vert T(n,m) \vert \leq ...
Probably the most famous example of a divergent term (ie, one which admits infinitely many $\beta$-reductions) in the $\lambda$-calculus is the Y combinator $$ Y = \lambda f. (\lambda x. f(xx)) (\lambda x. f(xx)) $$ The kind of the "heart" of the recursion here is the inclusion of the subterm $xx$. I wondered if this i...
I notice there are different definitions for CFG(basic block or statement), so let's consider following definition: Given a program, each statement is a node in CFG, and $(u,v)\in E\iff \text{v is successor of u ,or u is branch and u's target is v}$ Due to such definition, each node has atmost two out-edges. So we ca...
I am trying to find a lightweight data structure to find the nearest neighbor mesh (a mesh being a collection of non-unique triangles) for a given point in R3 (3D Euclidean space). I have seen nearest neighbor problems for points and triangles, but never meshes as a whole collective. So, in essence given a point P find...
I would like to know whether a theory exists which generalizes boolean logic to floats. Specifically, assume that instead of booleans 1 and 0, I have True/False tendencies, such as 0.9, where 0.1. Here, 1.0 would mean completely true, and 0.0 completely false. Boolean logic: 0 && 1 # == 0 0 || 1 # == 1 It should be po...
How do I represent DJNZ command of counting machine via commands of Universal Register Machine, those commands are CLR JNE INC and TR, via this commands i have to represent DJNZ command, any help would be great.
My question is generalizable to arrays of any type but I'll use strings to keep it short. We take a couple of strings as an input. Let's denote them ${S_1,...S_n}$. (Ex: "ABEF" and "CDE"). The output $U$ must fulfill the following conditions: The output must contain the entire "vocabulary" of all of the inputs and not...