instruction
stringlengths
35
29.1k
I am currently self studying approximation algorithms from The Design of Approximation Algorithms (Williamson and Schmoys; page 50 here), specifically the minimum-degree spanning trees (MDST) problem. Given a graph $G$, we need to find a spanning tree $T$ that minimizes the maximum degree of any vertex in $T$. I unders...
I am asked to write an C code Selection Sort algorithm and use loop invariant to show its correctness. We are given array A[1...n] of n integers. (Indexation 1 for clearance. In my code it starts at 0) int i, j, min_index, temp; for(i=0; i<n-1; i++) { min_index = i; for(j=i+1; j<n; j++) if(A[j] < A[min_...
What is the complexity of inverting a $n \times n$ diagonal matrix? From what I learn in algebra, the inverse of a diagonal matrix is obtained by replacing each element in the diagonal with its reciprocal. So is it correct to say that the complexity of inverting a diagonal matrix is $\mathcal{O}(n)$?
My specific problem is as follows: Given two list of texts (in the order of 5 to 50 items) Find best matching pairs with their corresponding matching score (weight) Where each item can only be matched once with another item (from the other list) While minimizing the calculation of the weights (Levenshtein edit distanc...
Given a bipartite graph $(X\cup Y, E)$ with edge weights, it is easy to find a matching in which the product of weights is maximum: replace each edge weight with its logarithm, and find a matching in which the sum of weights is maximum. Now, we would like to find a fractional matching which maximizes the product of val...
I tried to figure out the proof of insertion operation in AVL-tree is O(log n), but I do not know how. I also tried to find it somewhere on the Internet, but I could not find any good results. Do you guys have any ideas how do we proof that?
Given an undirected graph that is represented by its adjacency matrix, return whether or not is it possible to add no more than two edges to this graph in order to make all the degrees of nodes even. Keep in mind that in the resulting graph there should be at most one edge between any pair of nodes. For graph = [[false...
$$L =\left \{ \langle M \rangle \mid \exists x\in \Sigma^* \left(\left | x \right |\leq 10000 \wedge H(M, x\right) \right \}$$ Where $H(M, x)$ denotes whether Turing machine $M$ halts on input $x$. My guess is neither $R$ or $Re$ because I would have to run infinite TM's in order to find out if every TM halts on x or i...
Let's say there's a single process performed in the machine which utilizes all available processors (whether physical or logical processors). The process use 100% processor utilization most of the time on all processors. Which machine will perform better? Machine with 2 cores, 1 thread per core (2 physical processors)...
In the general case of an n bit booth multiplier, the maximum negative value is -2n-1. So with 4 bits we can represent -8 x -8 (M=1000, Q=1000). Now if we follow Booth's algorithm for multiplying n-bit numbers: count A Q Q-1 Operation 4 0000 1000 0 Initial Conditions 3 0000 0100 0 (00) Shift and decrement cou...
Based on CLRS Theorem 4.1, master theorem doesn't apply to $T(n) = 4T(n/2) + n^2 \log n$. However, I saw the 4th condition of master theorem on slides of Bourke. If $f(n)=\Theta(n^{\log_ba}\log^kn)$, then $T(n)=\Theta(n^{\log_ba}\log^{k+1}n)$. So $T(n)=3T(n/3)+n\log n$ can apply to case #2, see for example this questio...
I'm stuck with nested for loops that are dependent on the previous loop: for (i=1; i<=n; i++) for (j=1; j<=i; j++) x = x+1 the part that is confusing me is j<=i. I'm trying to figure out the asymptotic running time.
Suppose P $\neq$ NP. Prove or disprove if language is in P using a reduction or an algorithm: $$ \left\{ \left(G = (V,E), k, 0^{2^{|V|}} \right) \mid (G,k) \in VC \right\} $$ Suppose I have the this input $00000000$ I can construct a TM which calculates the number of vertices by applying log operation. So for this e...
I implemented a hierarchical linkage algorithm for a set of 5,000 points. Each point is defined with a longitude and a latitude. I read about this algorithm here. These are the steps: Compute distance matrix between all points (great-circle distance, not Euclidean) Find the pair of points with the minimum distance bet...
This is the formal definition of a minimum spanning tree taken from Algorithms by Dasgupta, Papadimitrious and U. Vazirani. Input: An undirected graph $G = (V,E)$; edge weights $w_e$. Output: A tree $T = (V,E')$, with $E' \subseteq E$, that minimizes $$ \operatorname{weight}(T) = \sum_{e \in E'} w_e. $$ My confusion...
So I have the following language: C = {<G,w>|G is a CFG in Chomsky normal form and w has more than one parse tree in G} How to prove that this language is in P (decidable in deterministic polynomial time)? I tried to come up with a polynomial-time algorithm and tried to show a reduction to a different language in P, bu...
This is a follow-up to a question that I recently posted here: Completing tasks on a graph. In that question, I posted the following: Consider a graph $G = (V, E)$, where $V = \{0, 1, 2, \ldots, n\}$. The graph $G$ is complete, which means we can traverse $(i, j)$ for all $i, j \in V$. At each vertex $v \in V$, there i...
I know this question may look stupid, but still.. Is the meaning of both "have no satisfiable assignment"?
I saw some proof but I didn't understood it, any simple one?
I don't know if this board would be an appropriate place for this question, but I have been trying to figure out how the divide-by-2 decimal to binary conversion trick works: in which you divide the number by 2, record its remainder and in the end write out the remainders in reverse to the get the final binary string. ...
In a 2007 article, Russ Cox (at presents, he leads the development of the Go programming language at Google) argues that regex engines in languages like Java, Perl, PHP, Python, Ruby are built on a different theoretical framework from implementations like awk or sed. Cox claims a difference in performance between 60s a...
I was reading Introduction to the Theory of Computation by Michael Sipser and I found the following paragraph quite interesting: During the first half of the twentieth century, mathematicians such as Kurt Godel, Alan Turing, and Alonzo Church discovered that certain basic problems ¨ cannot be solved by computers. One ...
I am trying to determine how many bits the TI-83 Plus uses to store floating point numbers. I am using the algorithm for approximating the machine epsilon given in "Numerical Mathematics and Computing" by Cheney and Kincaid. In TI-BASIC, it looks like this: : 1 -> E : While (1+E) > 1 : E/2 -> E : End : Disp 2*E The p...
I am interested in proving lower bounds for AM-like languages. The usual techniques for lower bounds in non-probabilistic machines don't work for probabilistic machines. Intuitively, when I think about showing lower bounds I usually think about showing for any algorithm $A$ some "bad input" that would contradict either...
Alpha-beta pruning is an optimization for minimax that reduces the number of nodes visited without changing the final result. However, both minimax and alpha-beta only return the optimal node value (not the optimal node itself), which means that in practice, a programmer must implement a method for identifying which of...
I am new to this forum as I want to explore data structures and algorithms in depth. I want to know from experts here what books or other resources would be best for someone like me who can be considered just above a beginner as far as data structures and algorithms is concerned.
I am working on a load balancer that schedules tasks that communicate over network. I want to test its performance, but I'm struggling to find test data for it. Currently I try to extract relevant data from google-cluster 2019 (https://github.com/google/cluster-data), microsoft azure (https://github.com/Azure/AzurePubl...
I understand that it's possible to build TM that check all the finite number of cases, so it's definitely in $R$, but I'm not sure why it's in $P$
I am working on a branch and bound problem and I was wondering if it is correct to prune the node with z = 21.667 and if so, how do we know that we will not get a better solution if we branch on this node?
I am studying about algorithm correctness and have enctountered this problem. function add(y,z) comment Return y + z, where y,z are natural numbers x :=0; c:=0; d:=1; while(y>0)v(z>0)v(c>0) do a := y mod 2; b := z mod 2; if a XOR b XOR c then x := x+d; c:= (a AND b) v (b AND c) v (a AND c); d :=2d; ...
I had this question in my exam. but my answer is wrong(I didn't receive explanations why...) $$f(\langle M\rangle,1^n)=\left \{ \texttt{the lexicographically smallest } x\in\left \{ 0,1 \right \}^n \cap L(M) \texttt{ if } n>100\texttt{ and }L(M)\cap \left \{ 0,1 \right \}^n \neq\varnothing \texttt{, otherwise undefined...
I saw a joke on twitter today that got me thinking on how to perform a time complexity analysis of this algorithm such as you can express that the worst case is dependent on the input value in addition to the input size. The joke algorithm was this sleep sort algorithm in javascript const arr = [20, 5, 100, 1, 90, 200,...
Problem: Suppose the running time of a certain algorithm is $O(n \ln n)$. We happens to the running time of the algorithm if $n$ doubles. Answer: Let $R_1$ be the running time of the algorithm when the input is of size $n$. Let $R_2$ be the running time of the algorithm when the input is of size $2n$. Let $R = R_2 / R_...
$f(x_1,...,x_m)=\min_{\emptyset\subset I\subseteq[m] }\left|\sum_{i\in I}x_i\right|, x_i\in \mathbb{Z}\setminus\{0\}$ How to prove $f\in \mathbf{POLY} \Leftrightarrow \mathbf{P}=\mathbf{NP}$? When $\mathbf{POLY}\overset{\Delta}{=}\{ f:\{0,1\}^*\rightarrow \{0,1, \}^* |$ exists polynomial TM which competes $f \}$
Right now I am stuck with the problem, how all shortest path trees can be created in O(n*m) given G = (V,E,c) with negative and positive costs without negative cycles and n =|V| m = |E| after execution of Floyd Warshall. We were asked to think about why this is not $O(n(n+m))$ and for which graphs we really would have ...
(this is a cross-post from mathoverflow) Assume I have an undirected edge-weighted complete graph $G$ of $N$ nodes (every node is connected to every other node, and each edge has an associated weight). Assume that each node has a unique identifier. Let's say I then have an input, $c$ of three edges (e.g $c=[4,7,6]$). D...
I am working through a problem in which I have to prove that a particular $f(n) = \Theta(g(n))$. I know that for this to be true there need to exist positive constants $c_1$, $c_2$, and $n_0$ such that for all $n \geq n_0$, $c_1g(n)\leq f(n) \leq c_2g(n)$. Simply put, the goal is to pick values for the constants such t...
The problem: There are $N$ houses for sale. The $i$-th house costs $A_i$ dollars to buy. You have a budget of $B$ dollars to spend. What is the maximum number of houses you can buy? There is an intuitive way to solve this problem in a greedy way: we must at first sort the house costs and then buy houses until we are ...
In Sipser's Introduction to the Theory of Computation, the provided proof for the union operation being closed for regular languages has a step for the transition function that I find a bit lacking. Assuming that $M_1=(Q_1, \Sigma, \delta_1, q_1, F_1)$ and $M_2=(Q_2, \Sigma, \delta_2, q_2, F_2)$ are two different FSMs...
Recently I thought of an algorithm for multiplication and decided to stop dreaming and start writing on paper my ideas, and even implement this to code (in this case - Python 3.9.1). I do not know if it resembles Karatsuba's algorithm, but I glanced at it and it seems to work very differently. The idea behind this mul...
In CLRS, exercise 4.4-5 the following question is asked: Use a recursion tree to determine a good asymptotic upper bound on the recurrence $$T(n) = T(n-1) + T(n/2) + n$$ In my recursion tree, the sum of level 0 is $$n$$ level 1 is $$(3/2)n - 2/2^1$$ level 2 $$(3/2)^2n-14/2^2$$ level 3 is $$(3/2)^3n - 74/2^3$$ and so ...
I am currently studying the roofline model. Wikipedia [2] shows the following example graph: The diagonal line shows $\beta * I$. But I do not understand why this line does not go through the zero point. If $I = 0$ so should $\beta * I = 0$. What am I misunderstanding here? [2] https://en.wikipedia.org/wiki/Roofline_m...
I was given this problem in class, and I have no idea how to solve it. The problem is: "Given a list of positive integers, divide the numbers into 2 groups such that the difference between the sum of each group is minimal, print that difference. The algorithm must be efficient." I guess by efficient they mean do not ...
I have been give a page table logical address of 0011 0110 1010 1010 and have been told that there are 512 entries into this page table in which the frame number is two times smaller that the page number. I have looked at previous posts but I am still not understanding what steps I must do in order to translate this lo...
I am looking for a technique or an algorithm that outputs a unique number/vector for each pixel of the image. I want to give the pixel a perspective so the neighboring pixels have more visibility and the farther away pixel have less visibility. Imagine if someone walks on the pixels, he sees different patterns, and I w...
I came across the chalk-and-string labyrinth analogy for depth-first search in Algorithms by Dasgupta et al. I have seen the code for the depth first search. Everybody knows that all you need to explore a labyrinth is a ball of string and a piece of chalk. The chalk prevents looping, by marking the junctions you have...
After looking at Can a computer determine whether a mathematical statement is true or not? for a while, I worry we may be into incompleteness/halting problem territory with this question, so an answer on that front, while disappointing, would also be acceptable I've been interested by ADT equations since I read the lin...
Suppose that we have two sums: a1+a2+...+an, b1+b2+...+bm We can perform only two binary operations on operands of these sums: lt (less than) eq (equal) These operations can return 3 possible results: true, false, unknown. Other operations like summation, subtraction and etc. are not allowed. The question is how to i...
Is it known that "For each problem in NP there is a randomized algorithm that solves it in polynomial time"? If not true then is there any proof of that. Or does it belongs to the unknown domain?
Is there a Turing machine such that, given a description $\langle M \rangle$ of a Turing machine $M$, an input $x$ and a string $y$, computes whether or not $y$ is the output of $M$ input $x$? My guess is that the answer is no because this might imply that the set of strings with Kolmogorov complexity greater than or e...
I just watched this explanation of zero-knowledge proofs with Avi Wigderson: https://www.youtube.com/watch?v=5ovdoxnfFV Key claims from the video: Every formal statement can be translated into a map in a way that preserves truth. If a statement is true, its map will be 3-colorable. If not, it isn't 3-colorable https:/...
I'm reading Computational Complexity by Arora and Barak and I had a doubt regarding a statement made about the equivalence of Turing machines: For every $f\colon \{0, 1\}^∗ → \{0, 1\}$ and time-constructible $T\colon \mathbb N → \mathbb N$, if $f$ is computable in time $T (n)$ by a Turing machine $M$ using alphabet $\...
This references the multiplication algorithm in Chapter 1 of Algorithms by Dasgupta et al. I am trying to understand how the code for multiplication à la française works from the multiplication by hand. This is the example given. This is the code given for it. I went ahead and did multiplication of $13 \times 11$ (od...
Given the Language $COMBI := \{\langle G,k \rangle | G$ has Clique $\geq k$ or Independent Set $\geq k\}$. Proof that Combi is NP-complete. I tried to reduce Clique <=p Combi. I had two different ideas: Let $f(\langle G,k\rangle) = \langle G,k\rangle$ so $\langle G,k\rangle \in$ CLIQUE $\Rightarrow f(\langle G,k\ra...
I'm not sure whether the distinction between decision and search problems has a deeper significance or if it is just concerns the immediate answer to the problem. Of course, if you have a finite solution space then you can easily turn a search problem into a decision problem by assigning a 'yes' to whichever output sat...
PCB structure exists inside kernel area. And in ready queue, which is Linked List, each Node of the queue is PCB. And this mean PCB Node has the next address of PCB in the queue, right?? Then My question is this.. Does PCB structure has pointer field that has address of next PCB structure?? According to Wikipedia, Jo...
I'm learning programming, Python 3 in particular, and I have a good book "Beginning Python - From Novice to Professional" by Magnus Lie Hetland, but the book doesn't explain algorithms at all, and I'm having truoble understanding some codes which include recursion since I'm new to 'CS-style' programming, I have moderat...
I'm reading The Algorithm Design Manual and I stumbled upon this problem. I can't really get my head around this, I don't even know how the number of multiplications could differ, what I mean is that there is no polynomial that would make this algorithm perform poorly. I also have no idea how this could get improved, e...
I know that SAT can be reduced to (3 vertex) Graph colouring, and there is a Zero-knowlegde protocol (ZKP) for graph colouring. However, I am interested in a ZKP that can be performed directly on a SAT instance, without graph colouring. Is there a known ZKP for SAT, and if not how would you suggest coming up with one?
Suppose that $A$ and $B$ are languages such that $A\leq_P B$ (many-to-one Karp reduction), and $B\in \mathbf{P/poly}$. How do we prove that $A\in\mathbf{P/poly}$? Using similar ideas like Cook-Levin (or $P\subseteq \mathbf{P/poly}$), I can show that given $x\in\{0,1\}^n$, there exists a (easily computable) poly-sized c...
def RecFunc(n): if n <= 3: return 1 return RecFunc( RecFunc(n/3) + RecFunc(n/2) + RecFunc(n/2) ) How should I start if it is nested inside? I know how to solve it without the outer RecFunc (with a recursive tree I assume) - But here there is an outer RecFunc and I don't know what to do! Thanks to Steven...
I wanted to test the feasibility of an idea that might be part of a small project, and I'm trying to set up a quick prototype using Python (with bindings to a C library). If any of this is sufficient for any interesting application, I might make this the main topic of my thesis. I was able to plot how much memory this ...
In the slides of a university lecture, the following phrase got my attention. Assuming 10GB network, it takes 2 hours to copy 1TB. My calculation was as follows. 10GB network = 10 gigabits per second network = 10 x 10^9 bits per second ------> (1) 1TB = 10^3 x 10^9 x 8 bits --------------> (2) Then the time to copy ...
Let $\chi_S: \mathbb{F}_2^n \to \{\pm 1\}, x \mapsto (-1)^{\sum_{i \in S}x_i}$ for every $S \subseteq [n]$ denote the parity functions from $\mathbb{F}_2^n$ to $\{\pm 1\}$. Then, of course, every $f: \mathbb{F}_2^n \to \{\pm 1\}$ can be written as a linear combination (over $\mathbb{R}$) of the parity functions. I have...
I've built a rudimentary SAT Solver from scratch, and wanted to do the same with SMT solvers as well. While I've found two toy SMT Solver implementations in Haskell and Ocaml, but no tutorials or examples, which is a stark contrast from all SAT Solver tutorials out there. Is there a resource for building a toy SMT Solv...
I was going over the proofs of the non-deterministic time hierarchy theorem (the one in Arora-Barak and the one by Fortnow and Santhanam). They are available here: http://theory.cs.princeton.edu/complexity/book.pdf : page 67 https://blog.computationalcomplexity.org/2011/04/new-proof-of-nondeterministic-time.html It see...
Given a grid graph $G=(V,E)$ which has only two different integer costs/weights of 1 and 2. Find Minimum Spanning Tree in $O(|V|+|E|)$. I tried the following: Changing Kruskal using a counting Sort in $O(|E|)$. But can I say that this results in O(|E|+|V|)? Since Kruskal would normally be ${\displaystyle O(T_{sort}(|E...
As I understand it, A* is a general form of Djikstra where the selection of the next node to visit can be based on something other than the actual distance. For example, with Djikstra, you'd use a priority queue ordered ascending by distance and shift off the head of the queue to decide where to visit next. But with A*...
The reverse of a string, introduced informally above, can be defined more precisely by the recursive rules $$a^R=a,$$ $$(wa)^R=aw^R,$$ for all $a \in \Sigma$, $w \in \Sigma^*$. Use this to prove that $$(uv)^R = v^Ru^R,$$ for all $u, v \in \Sigma^+$. This is exercise 3 (page 28) from "An Introduction to Formal Languag...
I have the following pseudo code for a insertion sort algorithm INSERTION-SORT 1 for j = 2 to A.length 2 key = A[j] 3 // Insert A[j] into the sorted sequence A[1..j-1] 4 i = j -1 5 while i > 0 and A[i] > key 6 A[i+1] = A[i] 7 i = i -1 8 A[i+1] = key I am trying to convert it into execut...
Could someone tell why "G1 and G3 are ambiguous" and how to see whether a string has at least two different left-most derivations in general?
I am thinking about JavaScript here, or any language that supports async IO or that sort of thing (coroutines? though don't have much experience with those). I have looked at some of the resources below in trying to figure out how the stack works when you have async, but I don't understand it yet and don't quite follow...
I am looking for a solution for the following problem: Find the size of a subset of top $N$ elements, where the minimum element is at least $N$, in linear time. Consider the following sequence: $$ 3, 1, 6, 1, 5 $$ The answer here is $3$, with $6, 5, 3$ being in the set found. The value of $N$ is not a given - we're l...
I have a bit of problem in the question below, mainly in the case of incrementing the input size (it doesn't seem solvable to me, like, do we just write $f(n)/f(n+1)$ or...), and also the logarithm ones because I'm not really comfortable with those. I'd appreciate it a lot if you could take the time to explain them to ...
I was reading about online algorithms and bipartite matching. I found an implementation that works fine on several websites (like geeksforgeeks). For the online version, I found this paper https://people.eecs.berkeley.edu/~vazirani/pubs/online.pdf But there's one part that I don't understand. In this paper, they refer ...
What is the solution of the following recurrence? $$ T(n) = 3T(n/2) + n^2, \quad T(1) = 0. $$ I cannot use the master theorem since I need to know the exact final expression, not just it's big O, which I know is $O(n^2)$. I'm stuck at the following, after 4 steps: $$3^4T(n/2^4)+((3^6)n^2)/((2^6)2^6)+(3^3n^2)/((2^2)2^4)...
There is a similar question already asked on this site but does not have an answer as to how the 10x was converted into 2y. I know how to convert 8.75 or 875 into IEEE representation. But what about 106? Surely there's a better way than expanding it and then converting it into binary.
I'm kinda confused by Asymptotics, the exercises in the book I'm reading say to prove for example $f(n) = \Omega(g(n))$, and there is something I don't understand about these kind of proofs. Do I have to prove them algebraically or is it possible to find some constant ($c$) such that this statement holds? For example w...
Is there a data structure which can maintain a list of intervals and the following operations? insert(l, r): Inserts an interval [l, r] into the list query(l, r): Return the number of intervals in the list which are completely nested in [l, r] I need the data structure to handle inserting and querying without brute fo...
For network packets coming over TCP/IP protocol, have you ever confronted a situation where you need to store those network packets in tabular form similar to how tabular tables in databases? For example, keep the dst IP, dst src, TCP/UDP, payload, etc.? If you ever find yourself in a situation where you need to store ...
Let $\Sigma = \{a, b\}$ and $L = \{aa, bb\}$. Use set notation to describe $\overline L$. This is exercise 6 (page 28) from "An Introduction to Formal Languages and Automata" by Peter Linz. The author provides the following answer: $\overline L = \{\lambda, a, b, ab, ba\} \cup \{ w \in \{a, b\}^+ : |w|\geq 3\}$. Mine...
Let $L$ be any language on a nonempty alphabet. Show that $L$ and $\overline L$ cannot be both finite. This is exercise 7 (page 28) from "An Introduction to Formal Languages and Automata" by Peter Linz. My attempt: $L$ is a subset of $\Sigma^*$, so it can be either finite or infinite. If $L$ is finite, then $\overlin...
Quick question on the wording of the question from CLRS Ch2 Problems. The question goes as follows: Although merge sort runs in $\Theta(n\lg n)$ worst-case time and insertion sort runs in $\Theta(n^2)$ worst-case time, the constant factors in insertion sort can make it faster in practice for small problem sizes on man...
Prove that $(L^R)^* = (L^*)^R$ for all languages $L$. My attempt: Suppose $w \in (L^R)^*$. So, $w = w_1\dots w_l$, for some $w_1, \dots , w_l \in L^R$. Since $w^R \in L$, then $w^R = w_l\dots w_1$, for some $w_l, \dots , w_1 \in L^*$. Therefore, $(L^R)^* \subseteq (L^*)^R$. Honestly, I don't know how to proceed onwar...
how to write a program that display the total running time of a given algorithm based on different situations such as processor speed, input size, processor load, and software environment?
If it is known that for some optimization problem there is a greedy algorithm that solves it and the solution includes sorting of input at the preliminary stage, is it necessarily true that the problem belongs to P? I was told it is true that problems of this type must belong to P, but I have questions about whether th...
I was told that exponential time always beats polynomial time but doesn't this not work for: $n^{\frac{1}{2}}$ vs $2^{\sqrt{log \,n}}$? If we take $log_2$ on both of them we get: $\frac{1}{2}log \,n > \sqrt{log \,n}$ which seems that what I was told is incorrect. Did I not hear the caveats? Have I mislabelled exponent...
I have a hard time seeing what the alternative approach is in linearizing a directed acyclic graph (DAG). Chapter 3 of Algorithms by Dasgupta et al. states: Property Every dag has at least one source and at least one sink. The guaranteed existence of a source suggests an alternative approach to linearization: Find a ...
Is there any literature / results to which fragment of the modal mu-calculus the logic CTL corresponds? I know that in order to tranlsate the until operators of CTL, it suffices to use a single mu-operator. Does this imply that CTL coincides with the fragment of the mu-calculus containing those formulas that are built ...
I would like to define a grammar that produces and recognizes the counting numbers of the English language. I created the production rules below based on the assumption this is context-free, but I am not entirely sure thats the case. Is this a context-free or context-sensitive grammar? If context-free, do my product...
I am not quite sure, whether automata can construct languages over their types. For example, a Push down automaton can construct a language of type 2 - does that mean that a PDA also can construct a language of type 3? The same for turing machine?
Hey guys I am having trouble generating strings from this language, I haven't seen a grammar that looks like this and can't figure how to generate strings from this grammar, is this Context Sensitive grammar? Thank you. $G=(\{S, L_x,R_x,W_x \},\{a,b\},P,S) \\ P = \{ \\S \to \lambda \mid L_x R_x, \\ L_x \to x \mid L_x...
I was reading about paging in OS , and one of the things I saw was the page table base register (PTBR). If the CPU generates a logical address (Consists of Page number + Offset) it needs to be mapped to Physical address (Consists of Frame number + Offset). In the mapping process there must be first a lookup in the Page...
The is an improvement to the X3SAT solver I described in What is wrong with this simple proof of P=NP? I have fixed the flaw found in that solver. Now, I want to know how often the solver described below will backtrack because of a particular learned clause. Exactly 1 in 3 SAT ($X3SAT$) is a variation of the Boolean Sa...
Let us start with the following well-known definition: Definition 1. Let $C\subseteq A^n$ be a code over $A$ and let $t\in \Bbb Z^+$ be a positive integer. We say that the code $C$ is $\boldsymbol t$-error correcting if nearest neighbour decoding is able to correct at most $t$ errors, assuming that if a tie occurs in...
I'm trying to prove that a context sensitive language ⊊ Turing-acceptable language. I was thinking of working out the complement of the language $A$, where $A$ consists of all words $w$ such that $M_w$ is a 1-NTM that accepts the input $w$ without leaving the input area. Unfortunately, I can’t figure out how to really ...
I have a pipelined stream processing situation, where a number of streams is linked in the computational process S0 -> S1 -> S2 -> .... You can understand "stream" as a list of numbers. In this process, S0 is initially given in totality. S1 is a mapped result from S0 according to function f; S2 is the result from S1 by...
How can it be proven that a deterministic CSL = semi-deterministic CSL? Does that imply that a CSL = semi CSL? Would I need to build a Turing machine, since a language accepted by a Turing machine is considered semi CSL?
Text message constantly keeps adding more emoji so I know the protocol could be extended with a delimiter at minimum. How does RCS compare to extending text message protocol? I ask this because I somehow doubt Apple will adopt the new standard but could be wrong when it doesn't support encryption. Here is a list of fea...
I'm learning about Traveling Salesman in an online course (sorry I can't share the link it's paid only) and the first step to solving it then just state "as a heuristic we avoid crossed paths" and never really explained why. Why are crossed paths bad in traveling salesman?