instruction
stringlengths
35
29.1k
I had a question regarding removing lambda-productions from context-free grammars. I understand that the basic theorem or process for removing lambda-productions is to find nullable productions and replace them with the version of the same production when we use lambda. However, I had a question regarding special cases...
Consider a weighted undirected acyclic graph consists of m source (root) vertices and n target vertices. The m-spanning tree problem of the graph is defined as that: (1) each of the m spanning trees starts at one different root vertex and connects a subset of the n target vertices; (2) one root vertex might not connec...
Serializability is the strongest consistency level with regard to the execution of two concurrent transactions T1 and T2. That is, if T1 and T2 independently change the application between consistent states, and a concurrent execution of T1 and T2 is equivalent to a serial execution of T1 and T2, then that concurrent e...
Are there any known bounds on the impact of changing (for example) one bit in a string on the resulting string's Kolmogorov Complexity? In mathematical terms, does the equation $|K(x) - K(x')|$ (with $K(x)$ as the Kolmogorov Complexity of $x$ and $x'$ as the string resulting from changing an arbitrary bit of $x$) have ...
Wikipedia says that: If a mesh covers more pixels in screen space than it has vertices, interpolating colour values from samples of expensive lighting calculations at vertices is less processor intensive than performing the lighting calculation for each pixel as in Phong shading. Why does it matter that there are mor...
Assume we have a big 2d array. All its elements are either zeros or natural numbers. A local minimum is an element that is less than all its 8 neighbors. Is there an effective algorithm to find all local minima in the array?
I have a table consisting of some headers $P, Q, R, S$ (shown in blue in Table 1). According to the headers, the column $T$ is populated using some predefined logic. Now, any of the headers $P,Q,R,S$ may be wildcarded to match all values. The aim to to compress the table using wildcards so that column $T$ is not affect...
Read this many years ago and can't remember who it was about. Nor can I remember the exact quote. The story goes: Famous computer scientist/professor is teaching a class. Student is having some problem w/ a machine and wants to reboot it, hoping to fix the issue. Professor chides him, saying something to the effect of...
Let's say we have the following rule for that particular Nim game: You have multiple heaps, and you have to remove 1,2 or 3 sticks (not more) from a SINGLE choosen heap. The player who pick up the last stick LOSES. (misere game). Is there an algorithm which solves this variant of Nim game ? Thanks in advance!
I need to find all possible paths in a directed graph, that may have loops. The graph has a defined start and one or multiple defined endings. Basically im trying to find all possible scenarios in a Use Case Description. Since loops may occur, the user may define how many times a loop/alternative flow may be repeated. ...
I'm working on a problem that combines Steiner Trees and Shortest Path trees. We have a (sparse, connected) graph $G=(V,E)$ with non-negative edge weights and edge lengths, a set of terminals $T \subset V$ and a root node $s \in T$. The goal is to connect all terminals to the root node while minimizing the total edge w...
I'm curious if there is any body of research that could be considered as the logical successor to Marvin Minsky's "society of mind" idea? It seems as if the notion of agents plays a crucial role in his thinking. I'd be interested in reading more about recent efforts in this direction.
I have a problem in a book I am trying to accomplish. I understand the overall type of the expression is boolean and how it derives. (y * x) will be rule 4 (counting from top right). (y * x) + x when evaluated will be rule 3 and the overall expression when evaluated will be rule 5. What I want to figure out is what i...
Can we achieve consensus (paxos, zab, etc.) without using a turing machine? What's the least powerful machine we can use to achieve consensus?
Suppose we have $x$ apples and $y$ boxes. Each box can fit at most 3 apples, and we say that a box is half full iff the box contains $\leq$ 1 apple. If each apple has a (non-empty) list of boxes that it can be placed in, what is a polynomial time algorithm that places apples in boxes such that the number of half full c...
I remember somewhere seeing the following. If $x$ and $y$ are integer variables then we cannot multiply them easily unless we know a bound $B$ on them. Suppose I have an array $\overline x=[x_1\dots x_n]\in\{0,1\}^n$ and $0\leq y\leq B_y$ holds and entries of $x$ and variable $y$ are integers then is it possible to mu...
I asked this on StackOverflow, but, alas, no answers. I'd like to use CRC or similar codes to check whether certain very large objects are likely to be identical. The trouble is, small parts of these objects are sometimes modified, and it would be very inefficient to re-compute CRC code from the entire object. Think of...
I know that there are $2^{32}$ different combinations of IPv4 addresses possible , if expressed in binary. In decimal notation, they range from $0.0.0.0$ to $255.255.255.255$. So are there $256^{4}$ possibilities if expressed in decimal? And $16^{4}$ in hexadecimal? Thank you.
I am intrigued by Triple Graph Grammars (TGG) as a potential for formal mathematical proof. Triple Graph Grammars (TGGs) are a technique for defining the correspondence between two different types of models in a declarative way. In some systems, proofs are simply trees of rules being applied to transform one syn...
I have a priority queue (using a max heap) that preserves insertion order for duplicate priorities, such that equal priorities fall back to FIFO behaviour. I'm doing this by creating a node with the value, the priority, and an 'insertion stamp' that is basically an incrementing number on the structure. I'd like to remo...
If I have two arrays containing max and min points which make up an envelope. It's quick to test if any point in a given data array goes outside of that envelope using: for (int i = 0; i < envMax.size(); i++) { if ((data[i] < envMin[i]) || (data[i] > envMax[i])) { return false; ...
Let $L = \left\{ \langle \alpha, x\rangle \mathrel{}\middle|\mathrel{} \textrm{x is the only string accepted by}\mathrel{}M_\alpha \right\}$ and $HALT = \left\{ \langle \alpha, x\rangle \mathrel{}\middle|\mathrel{} M_\alpha \mathrel{} \textrm{halts on input x} \right\}$ How can I prove that $L$ is undeciable by reduc...
I am looking for a name for the property $\mathbf{?_2}$ (and for that, it is sufficient to find a name for the property $\mathbf{?_1}$ since "Uniform" could then be added in front of it). Confluence : If $t_1\leftarrow^* t \rightarrow ^* t_2$, then one of the following is true: There is $t'$ such that $t_1\rightarrow...
Given a CFG in Chomsky normal form, is there an algorithm that solves the emptiness problem in linear runtime? I thought about using depth search here, but I think it's a little bit above linear runtime.
I am unsure where to start with this. From what I understand so far, 'VAR(x)' corresponds to Rule 2, ':= VAR(x) ' refers to Rule 5 and '+ NUM (1) refers to link 3. a := (b+c)*(-e); becomes t1 = b + c t2 = – e a = t1 * t2 I understand the translation above, What I am not that clear about are the recursive rules. How ...
Suppose we have a small computer network, there are 30 random people who have provided their computers to perform any computational tasks on them. Let's call these 30 computers nodes. We can access any of these 30 nodes arbitrarily, but by the condition of the problem, we do not know whether the node is honest. That is...
In my understanding, a lambda expression is a normal form (NF) when it has no redexes. For instance, $\lambda x.x$ is a NF, but $(\lambda x.x)y$ is not. A lambda expression is a weak head normal form (WHNF) if the root expression is not a redex. For instance, $\lambda x.(\lambda y.y)x$ is a WHNF, but not a NF as it red...
Let $(P)$ an Integer Linear Program, where we aim to find $x\in \{0,1\}^n$ maximizing a linear function $f:\mathbb{R}^n\rightarrow\mathbb{R}$ under some linear constraints $Ax\le b$ Let $(P^*)$ be its relaxation, which means that the constraint $x\in \{0,1\}^n$ is replaced by $x\in [0,1]^n$. Then, suppose that we know ...
I'm trying to build a graph with $n$ vertices and $k \cdot n $ edges, I need to make sure that this graph is $2k$ connected, meaning that it cannot be disconnected by removing at most $2k-1$ vertices. I'm looking for an algorithm that given n,k outputs such a graph.
I've been thinking about this question ever since I learnt about the $O(n\log(n))$ sorting algorithms such as MergeSort, QuickSort (average case is pretty much worse case with a good choice of a pivot) and HeapSort. I've been thinking how can we possibly achieve a greater class of efficiency in worst case? Can we do so...
I understand you can use process wide mutexes, but does this still apply if you have an additional virtualized operating system provisioned? For example, take two OSes: O1 and O2 where O2 is a virtualized OS provisioned on O1. Now take some code C that uses a process-wide mutex. Run C on O1 and O2. Assuming they have a...
I have written the following recursive structure for finding length of longest increasing subsequence. int lis(int arr[],int n,int k,int prev) //k=0 (pointing to start) { //prev=0 (value of prev element included in subsequence) if(k==n) return 0; int res; if(arr[k]>=pr...
I was wondering if you could help me to understand the difference between analogue and digital data. I looked it up online but couldn't find a proper answer. If for any reason this is the wrong site for my question please guide me to the correct site, Thank you.
I've recently started to deal with complexity theory and I'm trying to wrap my head around all the definitions and why they make sense. One thing I don't quite understand is the importance/necessity of co-NP as its own set/class of problems. Couldn't for example TAUT be classified as a NP-complete problem just like SA...
A non-recursive linear Suffix Array construction algorithm is presented in this thesis: Linear-time Suffix Sorting. The author claims that, overall, the algorithm runs at $O(n)$. While it is well explained, there are only hints that this is case. The implementation of the algorithm is in this GitHub repository written ...
Given a permutation $P$ of an unknown array $U$ of length $N$ and a function $f(Q)$ that calculates the minumum number of swaps between consecutive elements of array $Q$ to reach $U$, what is the minimum number of invocations of $f$ to discover $U$, worst case? An upper bound of $N$ invocations is at hand: Calculate ...
Given a language $L$ over $\Sigma=\{a,b\}$ let us define $L'=\{uv : u \in L \; \land v \in L^R \; \land |u|=|v|\}$ Prove: if $L$ is regular, then $L'$ is a context free language. I know how to solve it by building a push down automaton and proving it acceps $L'$, but I'm trying to solve it by using closure properties...
Let G be a graph with $n$ vertices such that $n\geq2$. Prove that, if $\mathrm{deg}(v)\geq \frac{n-2}{3}$ for every vertex $v$ in G, then G contains at most two connected components.
Description: Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It doesn't matter what you leave be...
Suppose we have a maximally triangulated graph $G$, where $V$, $E$ and $F$ is respectively the number of vertices, edges and faces. The following graph should be a maximally triangulated graph. Apparently, the equation $3F = 2E$ holds for $G$. Why (intuitively) is this the case?
What is the difference between multi-agent systems (MAS) and distributed systems, in the context of control with agents?
Let's look at example AF(φ1 -> AG(φ2)). Does it mean that: In all paths it eventually happens that if φ1 was satisfied, φ2 is satisfied all along the path (so it basically means φ2 is satisfied in all states in all paths) or In all paths it eventually happens that if φ1 was satisfied, φ2 is satisfied starting when t...
I'm trying to come up with a context-free grammar for the following language: $$L = \{a^mb^nc^{m+n}\mid 0 \le n \le m\}$$ My thinking is that i can rewrite this to $$L = \{a^mb^nc^nc^m\mid 0 \le n \le m\}$$ and then create the grammar $$ \begin{align*} S &\rightarrow aSc \mid B\\ B &\rightarrow bBc \mid \epsilon \end{a...
I'm implementing some estimation metrics that take samples of optimisation functions and estimate their properties. One of the metrics requires the data to be sorted; however, since the metric is only an estimation, I was wondering if I could get a comparatively accurate result if the data wasn't sorted precisely, but ...
I understand z-buffering as being "object-first" in contrast to "pixel-first" since the for loop starts with checking each triangle in the scene rather than each pixel. However, is this the same as rasterization, or is rasterization just a general technique that encompasses z-buffering?
After constructing the recursion tree i concluded a cost of $n^2\cdot log_2(n)-i\cdot n^2$ per level. So my total cost is: $$\sum_{i=0}^{log_2(n)}n^2\cdot log_2(n)-i\cdot n^2$$ $$=(log_2(n)+1)\cdot n^2\cdot log_2(n)-\sum_{i=0}^{log_2(n)}i\cdot n^2$$ $$=n^2\cdot log_2^2(n)+n^2\cdot log_2(n)-\sum_{i=0}^{log_2(n)}i\cdot n...
I have two processors, and I want to schedule as many jobs as I can. I have their starting time and finishing time, and each job has to be unique to a processor (no overlap). I looked around and found one processor, or n processors - but none for two. I thought it'd be popular but I can't find if anyone's done this bef...
A paper uses Haskell type classes to represent ontological categories. A type class hierarchy is used to represent "concept hierarchies" where "functions are the units of inheritance". Here is a diagram of the Haskell type classes based on the paper: With respect to the code below the following claim is made: The Has...
How would I solve the following problem? You have maps of parts of the space station, each starting at a prison exit and ending at the door to an escape pod. The map is represented as a matrix of 0s and 1s, where 0s are passable space and 1s are impassable walls. The door out of the prison is at the top left (0, 0) and...
As in, with the two final sublists which are sorted arrays, let's say just for this example (yes it is no longer fully MergeSort but I am interested in the time complexity only), that we finish with a constant time operation involving the two sublists. MergeSort in worst case is $O(n\log(n))$, and not having the final ...
I have a small context-free grammar, which I would like to use to turn input strings into parse trees. I need to get all possibilities in case of ambiguity (so shift-reduce is out), and there's quite a lot of left-recursion (so recursive descent is out). With these constraints in mind, I've implemented Earley's algorit...
This is the form of the problem where you start at a city, visit every other city, and return to the start city. Since you "return" to every city in the completed cycle, it seems intuitive that the cycle would be the same regardless of the starting city.
Assume you have m stacks each some elements within it. If you are allowed to do k pops , the objective is to maximize the sum(sum increases by the value of the popped element). What is the best algorithm which would be able to solve this problem. Can the complexity be improved if the details of the elements in each sta...
There's a board with given dimensions (NxM) and it has few queens places on some of the cells. We need to find in how many ways each cell is under attack by the queens on the board. e.g., ....Q .Q..Q ..... ..... Each empty cell is denoted by '.' and each cell having a queen placed is represented as 'Q'. For this confi...
so i have a good understanding about languages that belong to NP, P and NP complete, and how Polynomial reduction works between languages that belong to those areas. but i just can't figure out a conclusion about mapping reduction between languages in those areas. for example if i have 2 languages - A and B, that both...
Say I have a function like this: function colorize(integer) { var hex = '#' if (integer > 1) hex += 'ff' else hex += '00' if (integer < 100) hex += 'aa' else hex += 'bb' if (integer > 10) hex += '11' else hex += '22' return hex } It returns CSS hex colors, not named colors or rgb(...) values or anyth...
I understand the need for a universe hierarchy, and that each new level brings additionnal proof-theoretic strength. In the HoTT book there are examples of proofs that need to use the next level in the Universe hierarchy. Do we have examples of inhabited types A:U(n), where the construction of the inhabitants/proof a:A...
Regular expression: (0 + 01)(ε + 1)1(ε + 0 + 1)* I dont know if my answer to this is entirely right but please enlighten me if i'm way out of line. \begin{array}{c|ccc} \ &0&1&\\\hline q0&\{q0\}&\{q1\}&\\\ q1&\{q1\}&\{q1\}&\ \end{array}
Given $A, B$ languages over $\Sigma,$ Prove/Disprove: If $A _{\leq M} B$ and $B _{\leq M} A$ then $A=B$. I would like to disprove this claim, with the languages $H_{TM}$ and $H_\epsilon = \{\langle M \rangle\ |\ M \ halts\ on\ empty\ tape\}$ I can prove $H_{TM} {_{\leq M}} H_\epsilon$ by taking $\langle M,w \rangl...
I have the following byte: 0x0A and I need to test if a quadword contains it or no using standard bitwise operarion (or, nor, xor). For instance: 0x1689FFBB768922AC ---> false 0x106489320A792399 ---> true Unfortunately I cannot use intel SSE2 extension because this will make the code heavily depndent on the platform. C...
I am confused about the definition of sub graph isomorphism, wikipedia says that the subgraph isomorphism problem is a computational task in which two graphs $G$ and $H$ are given as input, and one must determine whether $G$ contains a subgraph that is isomorphic to $H$. Is this the correct statement or is it whether $...
I have a convex function of $n$ variables, $f(x_1,x_2,\dots,x_n)$ and need to find its minimizer. Are there algorithms that can retrieve the minimizer in an online fashion? i.e. solve for $x_1^{(opt)}$, $x_2^{(opt)}$ and so on in a sequential manner?
I want to calculate ϴ dependent on n for this algorithm: for (k = n; k < c; k++){ j = 1; while(j < n){ j++; } n is the parameter. c is a constant. I calculated the amount of operations to (c-n)*(n-1). But now I don't now how to deal with c.
I had a question regarding CNF (Chomsky normal form) in formal language theory. I noticed that a lot of authors (including my own professor, and the Wikipedia page for CNF) frown upon or don't allow the start symbol to be on the right hand side of the production. However, I just can't wrap my head around why this is so...
How do i calculate the complexity of this algorithm at the best case and its complexity at the worst case and the average complexity by assuming that the probability that the element is in the list is 0≤p≤1 and that all sites are equal probability
I'm reading the Model Chekcing book of E. M. Clarke and in the chapter about µ-calculus there is an example formula $$ f = \mu Z. ((q \mathrel{\mathrm{AND}} Y) \mathrel{\mathrm{OR}} \langle a \rangle Z) $$ As the author has mentioned, here $Y$ is a free variable, and we need an association list to pair $Y$ with the cor...
The term "concept drift" specifically relates to a model changing over time. However, a similar phenomenon may manifest in, e.g., spatial data, where a topographical model changes behavior at a land/water boundary. Another example may be in modeling the properties of a chemical substance, which change in behavior acr...
Does $R(L_1\cdot L_2)=L_2\cdot L_1$? Where $R$ is the reverse. I can't think about counter example
Is there any algorithm to calculate maximum number of node splits that can occur in given number of insertions and highest branching order? Lets say I want to insert 10 elements to an empty B-tree with highest branching order of 3. Is there way to calculate the maximum number of splits that will occur?
I'm looking for a general reference cataloguing types of automata. Any introductory textbook will cover DFAs, NFAs, PDAs, and TMs, but there are countless more automata of practical or theoretical interest — linear bounded, embedded pushdown, nested stack, tagged finite, and so on. Online resources for these tend to be...
I'm trying to prove the Connected Vertex Cover problem is NP-complete. That is given a graph $G=(V,E)$ and integer $k$, is there a subset $X$ of $V$ such that $|X|≤k$ and that for every edge $(u,v)\in E$ at least one of $u$ and $v$ are in $X$. Furthermore, the subgraph $G[X]$ induced by $X$ must be connected. I know th...
I am working on Minimum Dominating sets for bipartite graphs. There can be many minimum dominating sets of same size and I want vertex which is present in all of them. My approach for generating dominating sets is try all subsets of vertex and check if it is minimum dominating sets and then take the intersection of all...
Lookup tables can convert a piece of computational time into space. I remember that it was a part of a complexity theory course, but I cannot recall how it's called in its terms. I know how to use lookup tables in code to increase performance of my applications, so I don't need a definition of it in common sense. I wan...
There is a set of 2D polylines, each polyline defined by an ordered array of vertices (each vertex is joined with the previous one by a line, if drawn). Together, when drawn, these polylines form one or more contours, but they can be fragmented (a single contour consisting of several polylines) The task is to build ne...
I would like to apply Hoare Logic to realistic, complex imperative programs that use while loops, if statements, functions, modules, etc. and have side effects (e.g. access the network). In order to get started with using Hoare Logic, I would like to see what it takes for this simple function: function colorize(integer...
My intuition is that 1) self-awareness (modeled through epistemic modal logics); 2) goal reasoning (e.g. https://www.aaai.org/ocs/index.php/AAAI/AAAI16/paper/view/12292) and 3) consciousness (e.g. Integrated Information Theory) are the necessary and sufficient features for agent to be truly autonomous. Especially - con...
How can I show that the lower bound for getting a triangulation from a point set in the plane is $\Omega(n \log n)$? I know that the lower bound for finding the convex hull for a point set is also $\Omega(n \log n)$. Is it valid to argue that since the convex hull is also part of the triangulation it can't be done fast...
I have one or more second-order logic formulas that correct for some finity model. What operation can I perform on them, so that resault is also correct for some finity model? Just conjunction is impossible, example: $x$ has finity model, $\lnot x$ has finity model, but $x \wedge \lnot x$ has not finity model. Are ther...
Let G be a connected graph, knowing that it has more than 9 vertex, Show that either its independence number is bigger-equal than 4 or its click number (the size of the biggest fully connected group) is bigger-equal than 3.
Given these 5 axioms of Hoare Logic: \begin{array}{cl} \frac{}{\{\phi([x \leftarrow E])\}\ x := E\ \{\phi(x)\}} & \mathtt{Assignment}\\\\ \frac{\{\phi\}\ P_1\ \{\eta\} \quad \{\eta\}\ P_2\ \{\psi\}}{\{\phi\}\ P_1; P_2\ \{\psi\}} & \mathtt{Sequencing}\\\\ \frac{\{\phi \land B\}\ P_1\ \{\psi\} \quad \{\phi \land \neg B\}...
As an exercise in better understanding, I have been implementing the LTL to Generalized Büchi Automaton translation algorithm of Gerth, et al. (which is also discussed in Clarke, et al., Model Checking). What I have ended up with seems incorrect, but also seems to accord with the discussion. Both of the presentations ...
The terms "data", "information" and "knowledge" are quite interchangeably used in Computer Science. Strictly speaking, they do carry a very different meaning. I want to know their precise meanings and their context and usage. According to my limited experience, data is simply "raw fact and figures" whereas information...
Given this assertion in Hoare Logic: \begin{align} &\mathbf{\{p >= 0\}}\\ &s = 0 ; n = 1 ;\\ &\mathtt{while}\ (n <= p)\ \{\\ &\quad s = s + n ;\\ &\quad n = n + 1\\ &\}\\ &\mathbf{\{s == p * (p + 1) / 2\}} \end{align} How to prove this using the rules of Hoare Logic. I am not sure where to really begin, I only currentl...
I have been trying to wrap my head around applying Hoare Logic and am running into the question of how Hoare triples are any different from (simply) a typed function. That is, say you have a typed function $f : A \to B$. The initial state for the function is thus $A$, and the final state is $B$. Similarly, in Hoare Log...
Considering a 2-tag system as defined by wikipedia, how do I identify the result of the computation?
I'm trying to generate all permutations of N numbers where any two permutations are different by at least K positions. I would just like a push in the right direction, the trivial method of memorizing every valid permutation and then just comparing at each step would be impractical for large values of N. Example: N=4, ...
Suppose a binary tree with $n$ levels and exactly $2^n-1$ nodes. The nodes are random and their value does not determine their position in the tree at all. This isn't demonstrated in the picture, because I couldn't find a better image to use. The task is to find the path to a given node. Since the nodes are random, ...
Let's assume that DFA $A$ over the alphabet $\Sigma$ and with states $Q$ is maximal if for every function $f\colon Q\rightarrow Q$ there exists such word $w \in \Sigma^{*}$, that $q \cdot w = f(q)$ for every state $q \in Q$. Let $L \subseteq \{a, b, c\}^{*}$ be a non-empty language recognized by a maximal automaton wit...
Suppose one wants to uniformly sample a string $w$ of a given length over a finite alphabet, such $w$ satisfies a set of structural constraints (such as - "the third character has to be equal to the first character and the last character has to be equal to the second one"). The obvious method is to uniformly sample $w$...
How should I compute the maximum absolute and relative error of the following IEEE-754 floating-point expression? a.y + (x - a.x) * ((b.y - a.y) / (b.x - a.x)) Also, we assume, that the optimizer leaves the expression in the specified form the default rounding mode (round to nearest even)
Let say we have a Language $L = \{0^m1^n \mid m,n \geq 0 \land m \neq n \}$. If I want to use the pumping lemma to disprove that the language is regular or context-free, how do I choose the word in dependence of the number $n$? The problem is that I got an $m$ and an $n$ in the exponent and they cannot be equal. Can I ...
This question is about a few sentence description of what a proof would look like (and technologies / logics involved) for a complex api call through many layers. Trying to get a sense of the techniques and key points to watch out for. I understand it would take a lot of work. In learning about formal proof and verific...
We know all optimisation problems can be converted to decision problems. Is that true for search problems, counting problems and function problems as well? Description of the types of problems is given here: Computational problem. Edit: So, the comments suggest that I state more precisely what I mean. I'm not entirely ...
I'm trying to build logical representation from dependency tree with python. i created the tree with stanford parser. How can I derive logical presentation from it using Lambda-calculus?
For Timed Automata, I found Figure 1 below. For Coloured Petri Nets I found Figure 2. Both are for "Reachability Graph Construction". However, they don't describe where they got the states from (Figure 3), for generating the reachability graph. They assume you have "states" to generate a reachability graph, but I'm not...
I have the following problem: Given a set a of n positive integers, write a backtracking C function that prints out all the subsets of a such that the product of their elements is p. Use an array for implementation of the set. What is the time complexity? I have already solved the problem, both the idea and the C cod...
I am having trouble understanding a question related to Huffman Coding. We haven't studied it a lot, so I am not even sure how to start. Given $n ≥ 2$ characters, with probabilities $p_{1} \geq p_{2} \geq ... \geq p_{n}$ Let $p_{i} = 2^{k_{i}}$ with $k_{i} \in \mathbb{N}$ and $\sum_{i=1}^{n} p_{i} = 1$ Show that $p_{n-...
First of all, I saw many answers of this topic in Quora, Stackoverflow, and this site. But, I couldn't definitely understand the difference between dynamic loading and dynamic linking. What I understood until now is this. Dynamic loading : system library or other routine is loaded during run-time and it is not support...
I am trying to prove an elementary thing, but it seems at some point you get down to atoms where you can't prove anything else. This is why I am wondering about proving $c = a + b$, it seems like an atom. \begin{align} \{a, b\}\\ c = a + b\\ \{a, b, c = a + b\} \end{align} This is my attempt at a Hoare assertion....
Isometric path (like geodesic) is yet another name for shortest path. An isometric path cover is a set $S$ of isometric paths such that every vertex $v ∈ V$ belongs to at least one isometric path of $S$. The isometric path cover problem is to find a minimum cardinality isometric path cover of $G$. Is the isometric path...