instruction
stringlengths
35
29.1k
Note: I figured this out, but haven't had the time to write an answer for it: see the comment. For reference: the discussed material appears in http://www.cs.ru.nl/B.Jacobs/CLG/JacobsCoalgebraIntro.pdf page 111. On page 285 of "Introduction to Coalgebra" by Bart Jacobs, Proposition 5.3.3 is stated as follows: Let $\ma...
When we discuss P vs NP we are looking at the difference between problems that are easily solved versus easily verified (wrt polynomial vs exponential time). But in both cases these are black-and-white results. We do/don't solve the problem, we do/don't verify the problem. What about cases where there is subjectivity...
In the context of languages (not grammars), I know following: $LL(0) \subset LL(1) \subset LL(2) \subset \cdots \subset LL(k)$ $LR(0) \subset SLR(1) = LALR(1) = LR(1) = SLR(k) = LALR(k) = LR(k)$ $LL(0)\subset LR(0)$ $LL(n)\subset LR(1)$ for all $n$'s How does $LL(n)$ languages compare with $LR(0)$, for $n>1$?
I've noticed that correlating the number of comparisons done by a naive implementation of QuickSort with the percentage of elements that were already sorted gives you a curly-brace-shaped-curve if you use logarithmic scale: So, how can this curly-brace-shaped curve be mathematically described (the red curve represents...
I'm trying to describe a data structure by production rules. The structure is recursive; say a list of type $A$ made of elements of type $A$ or $B$. Writing the grammar, I build this: $(S \rightarrow AS|ε)$ $(A \rightarrow AA|bA|ε)$ where $b$ is a terminal representing element $B$ of my list. The production $A \right...
While reading corman book, i just came across examples to find strongly connected components in a directed graph. But it turns out be disjoint union of cycles. Is this true for all directed graphs? What about biconnected components? are they also disjoint union of cycles? please correct me if am thinking wrongly
Okay, so I was reading a bit about P vs NP problems. And I found out that proving P Vs NP is an NP problem. And since if we prove that any problem in NP is a P that would mean that we have NP=P. So by that logic either NP==P or it can never be proven that NP is not P and if somebody proves that, then won't they be co...
Given this function specification, where name xs is bound to a list, # denotes its cardinality and . is the list index operator... $$\left( \sum i: 0 \leq i < \#xs: xs.i * (i + 1) \right)$$ I need to derive a recursive function using induction. Base case: [] \begin{align} \left( \sum i: 0 \leq i < \#[]: xs.i * (i + 1)...
I've grown up with computers. While watching old computer TV programmes and documentaries and reading the news about constant issues with these modern systems -- everything from the sheer amount of change/bloat/costs to all the security and privacy issues -- one thing that really stikes me hard is: Why do normal people...
There are many examples where someone replaces a CPU with a GPU or an FPGA and get a performance boost of $\times 100$ or more, but is it possible for a change in the architecture of computational resource to reduce the least possible complexity of solving a problem, say, from $\Theta(n^2)$ to $\Theta(n)$? Basically, I...
The problem is, K_longestPath: We are given a graph in which some of the vertices are "cities". No two cities have an edge between them, thus every city must be at distance at least 2 from each other city. We have to find a path that goes through each such city without forming a cycle. We are given the Graph with a ...
I'm writing a report on amortized analysis, and I'm using the example of a dynamic array to explain each method. I think it would be nice to add a reference to when this example was first used, as it seems like it is a classic example. I've been looking and can't seem to find a reference to it. Does anyone know when t...
According to the Wikipedia link of IBM hexadecimal floating point: Consider encoding the value −118.625 as an IBM single-precision floating-point value. The value is negative, so the sign bit is 1. The value 118.62510 in binary is 1110110.1012. This value is normalized by moving the radix point left four bits (one...
What is the best way to create an ensemble of neural networks utilising weighted averaging when these networks were trained to minimise cross entropy error function? The literature I found (e.g. [1]) seems to be talking only about weighted averages of neural networks that employ mean square error (MSE) cost function. A...
This proof is from the book "Introduction to Languages and the Theory of Computation" by John C. Martin. My question is from the pink part at the second page: It follows in particular that no sequence of moves can cause M to empty its stack. and further, it talks about $y_x$ that is my second question. I can't under...
I have this example code, which is an undefined language. We want to know what will be printed if we use static versus dynamic scope. def fun1(a): var z = 1 def sub1(c,e): def sub2(d): print(z) sub2(z) print(z) def sub3(b): var z = 2 var s = 1 sub1(z,2) sub3(z) var z = 0 fun1(3) p...
Statement: Every $T(n)$ size bounded Boolean circuit family, could be simulated with $(T(n))^2$ time bounded Random Access Turing Machine (RAM). Could you please supply me with a reference to an article\ book that states the above? I am willing to attach this statement in my article, without needing to prove it myself
I am probably not phrasing this question well, so please bear with me as I try to explain what I mean. I am working on learning category theory, as applied to programming. So far, I understand that: Objects in a category are "unbroken"; you're not supposed to peer inside them to see their internal structure. Any Set ...
The game goes as follows. Two players are playing a game, player 1 and player 2, in which the first player starts by naming a hero $h_1$, then player 2 responds with a villain $v_1$ who has played in a movie with $h_1$. Then player 1 responds with another hero $h_2$ who has played in a movie together with $v_1$, and so...
Consider a sphere sitting on an $xy$-plane, and take 2D slices parallel to the $xy$-plane at various heights of z. Suppose we take 10 slices, evenly spaced along the $z$-axis, and now have 10 images of circles each with a corresponding $z$. My goal would be a function that could learn from these 10 slices, such that i...
Suppose we have N elements, which we'll treat as a simple object. Is there a data structure I can use that will allow me to see which node appears earlier based on some arbitrary insertion order given a reference to both nodes? I'll need some kind of data structure $\mathcal{D}$, where $\mathcal{D}$ supports the follow...
So given an IP address it is converted into binary via calculating the binary of all different segments and then joining them. For example, 12.32.18.01 converted into a binary it would amount to this number in decimal form 12*2^24 + 32*2^16 + 18*8 + 01 My question is why to go through all this trouble and calculation....
So, while reading some problems on decidability, I came across the following resource: https://www.isical.ac.in/~ansuman/flat2018/tm-more-undecidable.pdf Here, on page no 12, it is written that the problem is decidable and with the following argument: "Yes, Simulate M on for upto m^481 · 482 · k steps. If M visits th...
I am trying to understand how a RAM memory controller gets data with instant access while reading through the memory. Let's say initially, ram gets the data at address 0 and then to get the data at some random location like 1234, does it not have to loop through the first 1233 addresses before reaching 1234? Please exp...
After some research and many youtube videos I have learnt that to prove a problem is NP-Hard; you would need to reduce that problem to known NP-Hard problems such as Subset Sum Problem, Halting Problem, Satisfiability Problem or Traveling Salesman Problem. Now my problem is Shortest Common Superstring Input: A finite ...
Let $\sigma = \{a,b,c\}$ and let $L = \{s | s = a^jb^jc^k\}$ where $k=i\cdot j$ and $i,j \geq 0\}$. Using the pumping theorem, prove that $L$ is not context-free. I really don't know where to start, here. Nobody in the class knows what to do and we're all failing pre-curve.
Hi im stuck on an exercise of ambiguous grammar. I need an example that shows that this grammar is ambiguous. The grammar is defined as follows: $$S \rightarrow aT | bR$$ $$R \rightarrow a | aS | bRR$$ $$T \rightarrow b | bS | aTT$$ Thanks!
I am trying to make a deterministic pushdown automaton from this language but without success. Here is the language definition: $\ L=\{0^n 1^m a^i b^j \ /\ m,n,i,j > 0 \ and \ m+n=i+j \} $ Thanks!
There is an unsorted list of $n$ items $x_1, \ldots, x_n$. Until you can sort the list, you are given one of the ${n \choose 2}$ possible binary comparisons uniformly at random (with replacement). On average, how many of these random comparisons will you need to be able to sort the list? Some follow-up questions: Wha...
Ever since I was introduced to modular arithmetic, I've had some trouble with it. I think it uses a part of my brain that I haven't used often. Anyways, I've been thinking about this specific equivalence: $$a^3 \equiv 5 \, (\text{mod } 7)$$ And I have a hunch that no $a$ exists s.t. this equivalence is true. Simulatin...
I am a novice in Digital Image Processing, and while reading the book of DIP by Gonzalez and Woods, I find that they have represented digital image as $f(x,y)$ but nowhere it is mentioned what is $x$ and $y$ actually that we are passing to the function $f?$ Does $f(x,y)$ represent the intensity of the points located at...
some suggested a thread in which the algorithm multiplies the 2 matrices with lowest values first. Mine is different: it divides by parenthesis the 2 matrices. And continues to the next section. The problem is: finding the most efficient way to multiply a series of matrices together, using an algorithm of some sort, an...
In a communication link out of p packets one packet will be lost. If stop and wait protocol is used then expected number of retransmissions for a packet? (A) P/(1-P) (B) P (C) 1/(1-P) (D) 1/P This has already been answered here Stop and Wait retransmission of packets? but I dont have enough reputation to comment there,...
Suppose we are given an integer $c$ and positive integers $k, N$, with no further assumptions on relationships between these numbers. We are also given the prime factorization of $N$. These inputs are written in binary. What is the best known time complexity for determining whether there exists an integer $x$ such that...
I've seen in many textbooks if say we have a problem $Q$, we write a non-deterministic algorithm in polynomial time to solve problem $Q$, and then from that point it results that $Q\in NP$. Why is that? Just because we could write a non-deterministic algorithm in polynomial time? Can't we do that for every problem?
Let A={a,b}. So the question is to write regular expression such that L(r) which consists of all words. My answer is this: L(r)= (a+b)* a* b* (a+b)* Is this correct? Also another solution is: L(r)=(a+b)* Is this correct? Is (a+b)* same as (a,b)* ?
While programming with buffers like uint8_t* in C++ I often arrive at situations on where I'm forced to do copies. For example, if I receive packets in chuncks from the world and I want to parse something big that is formed of these packets, I'd have to create a bigger buffer and store them, in this buffer, sequentiall...
The longest palindromic subsequence problem can be solved using dynamic programming because it is recursive and has overlapping subproblems, as described in https://www.geeksforgeeks.org/longest-palindromic-subsequence-dp-12/ . On the other hand, AFAIK there is no dynamic programming solution to the longest palindromi...
Consider having two sets $L$ (left) and $R$ (right). $R$ nodes have a capacity limit. Each edge $e$ has a cost $w(e)$. I want to map each of the $L$ vertices to one node from $R$ (one-to-many matching), with minimum total edge-costs. Each vertex in $L$ must be mapped to one vertex in $R$ (but each node in $R$ can be a...
I have a stream of tuples arriving in the following form: (timestamp,price). There is no pattern in the arrival of these data points (number of data points per minute is random). I need to be able to return the maximum price in the last hour at any point of time. What is the most efficient algorithm in terms of time co...
int[]A; int L=A.length-1; int index=(L-1)/2; int k=2*index+1; while(k<n){ if(k+1<n){ if(A[k]<A[k+1]) k=k+1;} if(A[index]<A[k]){ int t=A[index]; A[index]=A[k]; A[k]=t; index=k; k=2*index+1; }else break;
Let $a = a_1, \ldots, a_n, b = b_1, \ldots, b_m$ be sequences of positive integers and for any respective subsequence of length $k$, we consider $\sum_{i=1}^k (a_{x_{i}}-b_{y_{i}})^2$. Given a bound $D$, find the largest $k$ such that there exists subsequences of $a$ and $b$ such that $\sum_{i=1}^k (a_{x_{i}}-b_{y_{i}}...
Suppose I have a set of integer intervals, and I want to generate a visualization like the one attached. One obvious way of accomplishing this is to put every interval in its own row; this obviously respects the constraint that no two overlapping intervals are put into the same row, but it is hard to read because the n...
I have a planar(|E|=O(V)) undirected graph with positive edge weights. I have already calculated all pairs shortest path with Floyd–Warshall algorithm. Now I want to recalculate APSP with an edge removed. I'm not interested in the path and just having the distances is enough for me. I want a highly parallelizable metho...
I have a DAG and I want to list all pairs of vertices that are not comparable (there is no path from the first to the second or the second to the first). In this image (taken from this StackOverflow question): The output would this: {B,C} {B,D} The output can be $O(n^2)$ so that's a lower bound. My current best algor...
Suppose $a$ is an array and $cmp$ is a "compare function" that is a function which outputs $true / false$ values. I say that an algorithm $A$ which takes in input $a$ and $cmp$ is a stable sorting algorithm if $b=A(a,cmp)$ satisfies the following conditions: Sorting conditions: 1) exist a permutation $p$ such that $a \...
I was reading about Peterson's Solution for Synchronisation. Let's assume the two shared variables to be int bool flag[2] and turn. Lets also consider the two processes as P0 and P1. Initially, P0 executes causing - flag[0] = true and turn = 1. Now lets assume P0 is pre-empted by P1 causing - flag[1] = true and turn = ...
We have cyclic directed graph (possibly disconnected). For cycles consisting of two vertices A->B and B->A, we replace them by a single vertex. In case of A->B, B->C, C->A we also replace them by one vertex. We replace N vertices when all reachable from each other. Edges leaving a vertex stay as edges leaving the group...
i tried to look online and search this site and others but haven't found any good explanation to the following simple question: how many errors can a code with length k(k>2)fix?
Suppose that $F$ is a problem such that for every $n$, there is a program of length $O(1)$, running in polynomial time to $n$, that solves $F$ correctly on all instances of size less than $n$. Can $F$ be solved in polynomial time? That is, does there exist a single polynomial time algorithm that solves $F$ on all insta...
In HoTT book, section 1.5 (Product Types) in order to define the eliminators for the product type it assumes a function of type $g:A \rightarrow B \rightarrow C$ and then goes on to define the eliminator rule ,saying that we can define a function $f:A \times B \rightarrow C $ for any such g by: $f((a, b)) :\equiv g ...
Consider a binary search tree (AVL, red-black, whatever). The goal "find the least key strictly greater than the specified one" ("upper_bound" in C++ STL, higherEntry//higherKey in Java, etc.) can be implemented in manner (Java-like pseudocode): current = root; bestsofar = null; while (current != null) { if (example_...
The inclusion-exclusion principle for $n$ sets is proved by Kenneth Rosen in his textbook on discrete mathematics as follows: THEOREM 1 — THE PRINCIPLE OF INCLUSION-EXCLUSION   Let $A_1,A_2,\ldots,A_n$ be finite sets. Then $$ \begin{multline*} |A_1 \cup A_2 \cup \cdots \cup A_n| = \sum_{1 \leq i \leq n} |A_i| - \sum...
In the pi calculus, there is an equivalence relation between terms that are structurally equivalent and should "act the same", which is usually described as structural congruence rules. For example, the reduction rules are usually described modulo the structural congruence. My question is: in the context of a calculus,...
I googled, read several tutorials and watched several BST node deletion algorithm explanations before posting this question. For some reason, I cannot find a complete explanation of BST node deletion algorithms. I've found 4 algorithms to remove the node with 2 children from Binary Search Tree: 1) Find the smallest nod...
I have two questions: An 8-kB (8192 bytes) direct-mapped cache has 16-byte lines. The system has 64-bit addresses numbered from 0 on the right to 63 on the left. Which bits are associated with the offset, index, and tag? A 16-kB (16384 bytes) 4-way set associative cache has 8-byte lines. The system has 64-bit addre...
I came across the following problem in my complexity-theory course: Given a set of numbers $A := \{a_1, \dots, a_n\} \subset_{\mathrm{finite}} \mathbb{N}$ and a number $b$ also in $\mathbb{N}$ such that the following condition applies: $a_i$ divides $a_{i+1}$ for all $i < n$ and $a_i < a_{i+1}$. Prove that this special...
I have been told that inorder tree tranversal of binary search trees returns the tree elements in order. I came up with this binary search tree: 20 / 10 \ 26 However the inorder tree tranversal of this seems to be 10, 26, 20?! What is wrong here?
I'd like to know which is the difference between a task and a process in computer science. I'm studying a course on real-time systems and there are some definitions that I don't know. Thank you in advance.
I am a Computer Engineer. I studied basics of Quantum Computation. In dealing with multiple states, I feel NDFA does similar to Quantum Computation but we preferred to convert NDFA to DFA and solved problems. But in era of Quantum we prefer this multiple state quantum property to deal with major NP problems. Why? Where...
I have been reading Image Processing from Gonzalez and Woods and in the chapter Image Transformation I have come across this equation $$ T \left(u, v\right) = \sum_{x=0}^{M-1} { \sum_{y=0}^{N-1} { f \left(x, y\right) \, r \left(x, y, u, v\right) } } \,. $$ I am unable to understand this mathematical ...
Green Boxes = rectangles red dots = edge points red lines = to be generated from convex hull algorithm I have a problem with creating the convex hull algorithm. I want to select or collect all the edges from these rectangles and draw convex hull around through these edges (See red dots from the Image). To make my a...
I'm newbie in Computer Vision and image processing. I'm reading the article "Automated White Matter Hyperintensity Detection in Multiple Sclerosis Using 3D T2 FLAIR" and it said: 2.2.4. WMH Segmentation with High Spatial Frequency Suppression White matter lesions have higher intensity and generally clear boundaries ...
I need to determine the two monotone polygonal chains of a y monotone polygon. I have the vertices stored in an array. How can I do this?
My question is essentially the title. Let's say you have some random problem A. You prove that Vertex Cover (which is NP-Complete) reduces to A. You know nothing else about A besides that Vertex Cover reduces to it. Does that mean that A is NP-Complete? Or because we don't know if P = NP, we technically don't know if A...
As we all know, Gaussian Noise follows Gaussian or Normal distribution, and that distribution follows a $BELL$ $CURVE$. As we can see that most of the values are centered around the mean. Now consider this image When I add Gaussian noise to this image I get something like this As we can see that the noise appears ...
Its generally agreed that wait free queues have a consensus number of 2. But what about this following code for a consensus protocol for a queue. How is it that this does not go against the idea above? (Im going to have a wild guess and say this code is not wait free?) lets say we have a queue with 3 elements, and ther...
I often hear Prefetching as a technique for speeding up, for example, sequential memory access pattern. The prefetch should occur sufficiently far ahead in time to mitigate the latency of memory access, for example in a loop traversing memory linearly. According to the famous "What Every Programmer Should Know About M...
What are the advantages and drawbacks of considering ever longer block lengths or context lengths, if one was to work with estimated probabilities(measuring on the fly: aka "adaptive") rather than probability distribution that was measured offline(static). I have thought of the following advantages Lesser compressio...
I have to come up with a proof of correctness of the following algorithm: GuardedSearch(A; v) Input: an array A of n numbers and a number v Output: an index i such that A[i] = v, or NotFound if no such index exists i ← n while i ≥1 and A[i] ≠ v a. do i ←i−1 if i<1 a. then return NotFound b.else return i I know that ...
We have a set T of n elements and m subsets $R_i \subset T i = 1,...,m$. The $S_i$ are not assumed to be different. We also define an ordering of T, a one-to-one mapping $\pi$ of $T$ onto the set of integers ${1,...n}$. That is, every $\pi(v)$ is an integer from 1 to n and all $\pi(v), v \in T$ are distinct. For a set ...
Given two nodes U and V in a cyclic directed graph, how can I find the set of nodes that are part of a simple path from U to V? Attempt 1 I've tried using a DFS from U that stores the set of visited nodes when V is reached, and backtracks when a cycle is detected. But this algorithm must traverse all paths, and can hen...
The problem is to find $\mathcal{S}$, a minimal collect of subsets of $\{1,\dots, 17\}$ such that the two conditions are satisfied: if $S \subseteq \mathcal{S}$ then $|S|=6$; for any $A \subseteq \{1,\dots,17\}$ with $|A|=3$, there exists a $S \in \mathcal{S}$ with $A \subset S$. See here for a related combinatorial ...
Today I revisited the topic of runtime complexity orders – big-O and big-$\Theta$. I finally fully understood what the formal definition of big-O meant but more importantly I realised that big-O orders can be considered sets. For example, $n^3 + 3n + 1$ can be considered an element of set $O(n^3)$. Moreover, $O(1)$ is...
I was once given this question in an interview: Suppose a piece of paper has 80 columns of alphabets with a fixed size font, and now the paper is shredded vertically, into 80 vertical pieces (so each piece can show a series of alphabets going down vertically), and there are 300 pages of such paper shredded total. Assu...
Is it possible to make a Reinforcement Learning agent for path planning in a 2D grid where visiting certain intermediate states is mandatory? Please give an insight if it is indeed possible as to how I can proceed about it or give some reference. I mean how to achieve it. I have tried giving more rewards to each of th...
Is there some way to give a zero-knowledge proof that two $\lambda$-terms are convertible, i.e. equal modulo $\beta\eta$? A usual (and not zero-knowledge) proof that two terms are convertible is a path of terms between the two such that each step is either a single $\beta$ reduction or a single $\eta$ expansion, or the...
Anecdotally, Virgill III language forbids overloading since overloading resolution is at odds with the language support of functions as first-class citizen, when resolution can't happen at compile time. In my book, proper typing of overloaded function resolves this friction. Then, which typing would it be? Take +, whos...
I have 1D data for binary classification. Data includes about 10000 samples and each sample has the length of 120. Data is only partially labeled (for about 20% of samples, I am sure about the label) and I cannot label samples manually for thoes not labeled. Every ~60 samples come from same recording and therefore belo...
I understand that text processing could be done in various ways on top of operating systems: Shell utilities for processing a file (and/or a file name): tr, sed, awk, perl, mv and others text editors for processing a file (and/or or a file name): nano, Vim, Emacs and others; whether CLUI/TUI/GUI and whether for "plain...
How to show that $\mathbf{NP}^{BPP} \subseteq \mathbf{BPP}^{NP}$? I tried to build $NTM$ $M_{NP1}$, which uses $PTM$ $M_{BPP1}$. Show that there will always be $PTM$ $M_{BPP2}$, which uses $L ($$NTM$ $M_{NP2}$$)$ as the oracle language and repeats the actions of $NTM$ $M_{NP1}$ with the oracle $L ($$PTM$ $M_{BPP1}$$)$....
It's claimed in several texts on algorithmic complexity that prefix-free Turing machines are better for understanding randomness, at least in infinite sequences. In Nies' Computability and Randomness, the reason is given by theorems 2.2.1 and 2.2.2 on p. 83. I'll focus on the former, which states that for some plain ...
We define the problem SmallestAbove as follows: Given an array $A$ of $n$ integers and a value $v$, compute the smallest value in $A$ that is strictly greater than $v$. Return $\infty$ if no such value exists. (Here $\infty$ is just a very large integer constant.) You may assume that $A$ has at least one value ($n \g...
If a graph G(V,E) is connected the number of edges is at least the number of Vertices-1. It is pretty evident if you think about it but how do i prove it formally?
I was reading 'Category Theory for Programmers' by Bartosz Milewski and got really confused by the implementation of bimap in Bifunctor typeclass. class Bifunctor f where bimap :: (a -> c) -> (b -> d) -> f a b -> f c d bimap g h = first g . second h first :: (a -> c) -> f a b -> f c b first g = bimap g...
I am trying to understand if a programming language can have totally or almost totally the abstraction level shared between generally all human languages so that it would allow a human to code a machine, or to communicate with a machine, similarly to how this person would communicate with a human and in general the mac...
It's really interesting when this keyword first appeared as a lot of popular languages but relatively old languages( C++, C#, Java, JS ) use it. I understand use of "new" in C++ in practical manner( stack vs heap ). But i don't understand it in Java, Js, C# where all objects( except C# structs ) are created on heap by ...
I am defining the type Nat of natural numbers a recursive sum type: $$ Nat = \mu X. Unit \oplus X$$ Now, I have defined zero as the term: zero : Nat zero = fold Nat (Inl tmUnit tyNat tyUnit) and successor as succ : Nat -> Nat succ n = fold Nat (tmInr n tyNat tyUnit) Please note, that I am not completely sure of these...
Consider this Logic function : D = A B C + A B’ C + A’ B’ C + A B C’ + A’ B C’ + A B’ C’ I am trying to simplify it using Boolean algebra , I am stuck in this step : D= AB +B'C+ A’ B C’ + A B’ C’ So how do I continue simplifying it ?
I having been thinking about software and hardware and their relationship. I am a layman and do not have specialized knowledge on the subject. I wondered whether if studying a particular hardware a scientist could find out what software or programs are within the computer and if possible could I be given resources to r...
I develop an open source power systems software and I would like to include a simple collaborative mode so that more than one person could work on building a power system model. So far I have a table-based file format which is composed of many csv files bundled into a .zip file. My thinking is that when a synchronisati...
I was asked this question by an interviewer. I tried solving it using an array, such that I make sure the array in sorted when I insert. However I don't think this is the best solution. What would be a good solution for this problem?
Is possible to create DFA directly from regular expression. But for lexical analyse is needed "joined" DFA with many finish states, for example one state for string, one for integers, one for floats etc. How do such DFA? Maybe convert many DFA's to one or join DFA's to one NFA and next convert it to DFA?
I am trying to understand code distance, but I am not sure regarding the following scenario: Assume that you have an information word M with m bits, that You code into a coding word using the following procedure: You take M and code it using a code you know nothing about. But you do know that its distance(code's dista...
Consider this question: A program has 1M instructions and 30% of them are SQRT with CPI=8. The CPI of the rest of the instructions are 3. If we reduce the CPI of SQRT to 2, how much speedup is obtained? I have two solutions for that: 1- Using Amdahl's law, We have 1 S= -------------------- (1-alph...
Reading A Comparison of Methods for Solving MAX-SAT Problems, I can see that a MAX-SAT problem can be translated to an integer programming (IP) problem. Definition of MAX-SAT [Wikipedia]: The maximum satisfiability problem (MAX-SAT) is the problem of determining the maximum number of clauses, of a given Boolean f...
Never have I heard of a partially executed function before. But it seems the idea of it has been out for some time. Does a generator really stop execution at the machine code level, and that next time when the iterator is invoked, then there is a jump back to that machine code location to continue the execution? Or is...
I have a directed acyclic graph $G=(V,A)$, I want to cover the vertices of $G$ with a minimum number of paths such that each vertex $v_i$ is covered by $b_i$ different paths. When $b_i=1$ for all the vertices, the problem can be solved in polynomial time. But I am searching for the complexity of the problem when $b_i>...
I have the following language: $L = \{a^{n^2} | n ≥ 1 \}$ I am trying to construct a Turing machine that accepts L. My basic idea (without success) is to use a 2-tape TM where in the 2-tape compute the string with length $n^2$. After that, I wish to compare the length of the input string in the 1-tape with the lengt...
Consider the following local search approximation algorithm for the unweighted max cut problem: start with an arbitrary partition of the vertices of the given graph $G = (V,E) $, and as long as you can move 1 or 2 vertices from one side of the partition to the other, or switch between 2 vertices on opposite sides of th...