instruction
stringlengths
35
29.1k
I want to show that $L_1 = \{\langle M\rangle \mid \emptyset \subseteq L(M)\}$ is decidable/undecidable - without rice theorem (just for the case that I can apply it). Every language contain the $\emptyset$ as a subset. So my guess is that the language is decidable. Therefore, let us assume that $L_1$ is decidable. Let...
It is not hard to see that SAT for a CNF formula with $n$ variables and a constant number of clauses can be solved in polynomial time. On the other hand, it is not hard to see that a CNF formula with $n$ variables and $O(n)$ clauses is enough for NP-hardness (consider for example the instances of SAT associated with th...
A convex polyhedron can be represented by a set of linear inequalities. If the inequalities involve $n$ variables, then the polyhedron can be $n$-dimensional, but it can also be of a smaller dimension - in case some of the inequalities in fact define equalities. As a simple example, the following inequalities: $$x_1 \g...
I'm studying for an upcoming exam and my book gives the following definition: Let $M$ be a Turing machine, then the accepted language $T(M)$ of $M$ is defined as $T(M) = \{x \in \Sigma^* \mid z_0 x \vdash^* \alpha z \beta; \alpha, \beta \in \Gamma^*; z \in E\}$. As a side note, $\vdash$ denotes the transition from one ...
Is QMA known to contain Co-NP? If not, would Co-NP being contained in QMA have any implications for other complexity classes. (e.g. Causing the polynomial heirachy to collapse.)
This is taken from an old exam of my university that I am using to prepare myself for the coming exam: Given is a language $\text{Goto}_{17}^c \subseteq \text{Goto}$. This language contains exactly those $\text{Goto}$ programs in which no constant is ever above $17$ nor any variable ever above $c$. $Goto$ here describe...
I am confused about calculating the PARTITION procedure's running time. PARTITION procedure is used in the Quicksort Algorithm to partition the array $A[p...r]$ I analyzed the PARTITION procedure provided in the book Introduction to Algorithms: PARTITION(A, p, r) 1. x= A[r] 2. i= p-1 3. for(j = p to r-1) 4. ...
in theoretical computer science I learned for every recursive enumerable language there would be an enumerator and a grammar. So since word problem and halting problem are recursively enumerable, I was wondering what kind of grammar and enumerator could this be. And let the Wordproblem be $ L = \{ \langle M, w \rangle...
I know that, removing left factoring is a simple task. And i understand following procedure: $S→aA | aB$ Becomes: $S→aS'$ $S'→A|B$ Yet I'm running into problems with this particular grammar: $S→AD|bbS|bScS|BS $ $A→aAbb | abb$ $B→aB|ba|b$ $D→cDd|cccd$ How to remove left factoring from it, I'm trying to convert it in...
Given a two rectangular binary matrices $A$ and $B$ with dimensions $c\times a$ and $c \times b$ respectively, does there exist an invertible binary matrix C with dimensions $c \times c$ such that the total number of 1 entries in $CA$ and $C^TB$ is below a target threshold $t$? Here we are working in $GF(2)$, where m...
Given a list of numbers $S$ where $0 < s_i < 100$, find the minimum sum group of numbers with a sum bigger than $X$. Each number can be used multiple times. Ex: for $S = [3,4.1], X = 10$ the solution is $[3, 3, 4.1]$ Is it a known problem? What will be the best way of solving it? For now, my best solution is to randoml...
In the programming language theory world, there are two important terminologies, i.e syntax, and semantics. I can understand these two terminologies: syntax is about sentence's structure (e.g. a valid sentence by some grammar) semantics is about sentence's meaning (e.g. operational semantics, denotational semantics, et...
I was living in a country where Internet wasn't that fast so the younger me had the following idea for compressing data Let say 2 parties want to send data to each other, we know that data can be represented by a number literally any data no matter the size can be just a giant number. So let say the 2 parties have this...
I was reading the section of data structures for disjoint sets from the text Introduction to Algorithms by Cormen et. al .I faced difficulty in understanding few steps in the proof of the lemma as given in the question title. Here we assume we follow union by rank and path compression heuristics. Before we move into ou...
Preface So this is a question that came from an idea for a game. This game is voxel-based, and I am interested in calculating structural integrity, with some blocks that break after a limit has been reached. I know Medieval Engineers and 7 Days to Die implemented something along these lines, though I would like to see ...
Is this problem algorithmically decidable? L1 and L2 are both regular languages with alphabet $\Sigma$. Does L1 = L2? I think that it is decidable because you can write regular expressions for each language and see if they are the same. But I'm not sure how to prove it since I see that you prove something is decidable ...
In many programming language string is a token. For example: token ::= '"' string | digit nat string ::= char string | '"' nat ::= digit nat | ϵ This is a LL(1) grammar for some programming language's t...
I'm still new to Data Structure and Algorithm and therefore I would like to ease my doubts. I'm required to find the Big-O running time of myMethod(): Static int doIt(int n) { for ←1 100 do -> 100 for ←1 do -> n x 100 ←1;← -> 1 while < do -> lg n...
Let's consider the edge weighted online matching problem. The Vertices arrive online and reveal all their current edges and edge-weights $w_e>0$. The goal is to maximize the matchings weight. An edge can only be added once and irrevocably to the matching. As so often, we consider basically consider the setting from KVV...
Here is my problem. Problem Given two words and a dictionary, find out whether the words are equivalent. Input: The dictionary, D (a set of words), and two words v and w from the dictionary. Output: A transformation of v into w by substitutions such that all intermediate words belong to D. If no transformation is possi...
Based on the order by asymptotic growth rate which is more efficient?
For example if I've this: if a == false then return true else if a == true and b == false return true else if a == true and b == true then return false can be simplified to if a == false || b == false then return true return false; Truth Table would look like this: F T = T F F = T T F = T T T = F I want to come up w...
I have received a problem to solve and I am not sure what algorithm to use. TLDR; Find the shortest path to get to every node in a undirected graph The problem states that one must visit every station in the shanghai metro in the shortest path possible. Interchange Stations ('edges') can be reused and you can start / ...
I am looking at this post: Jamie is walking along a number line that starts at point 0 and ends at point n. She can move either one step to the left or one step to the right of her current location , with the exception that she cannot move left from point 0 or right from point n. In other words, if Jamie is standing at...
I tried to decide wheter the given Language $ L = \{ \langle M \rangle | M \space is \space TM \space and \space \exists \space w´,w´´\in L(M):|w´´|-|w´| \space is \space prime \} $ is recursive or recursive enumerable. I tried to prove not recursive (undecidability) through Rice's theorem, since there exists $M_1, M...
Assume that we represent a complete d-ary tree in an array[1,...n] (this is a 1-based array of size n). The formula for indices of children of node no. i is given as: {(1-i)d+2, ... , min{n,(1-i)d+d+1}} I am not able to get the intuition to arrive at this formula. Can someone please help ?
I have to design an algorithm to parse an array of terms and conjunctions into a grouped boolean expression. I never studied computer science and don't usually need this for web development, but today is different and I'm stumped. I'm getting input like so: a == 1 and b == 2 or c == 3 and d == 4 which I must turn into...
I was reading the book by Jurafsky and this is written by the author on HMM Although in principle the forward-backward algorithm can do completely unsu- pervised learning of the A and B parameters, in practice the initial conditions are very important. For this reason the algorithm is often given extra information. Fo...
From my understanding, the EDF (Earliest Deadline First) rule is essentially an iterative "version" of the EDD (Earliest Due Date) rule, which allows for preemption. At every point in time, EDF looks at all the processes present and sorts them into the processes with the earliest deadlines first and the latest deadline...
I was studying automata theory and formal languages and came across this question: If a grammar $G$ is left and right regular, why $||L(G)|| \leq ||P||$ ? I've searched the theory but I am missing something. And I cant find the answer anywhere, so I am asking here. Definitions: $P$ = set of rules Right-regular rule: gr...
Let ||L|| be the sum of all lengths of words in L und N(L) the number of equivalence claesses for the Relation $\equiv_L$ from Myhill–Nerode theorem. Proof, which values d can have with $d:=||L||-N(L),d\in\mathbb{Z}$ Some conclusions I came up with so far: |L|| is infinite, when L is infinite. Then d is not defined. W...
Problem I am considering the following maximization problem: Input is a finite collection of finite sets $\mathcal{F} = \{ X_1, X_2, \ldots, X_n \}$. Goal is to find a subset $G \subseteq \mathcal{F}$ that maximizes $|G| \times |\bigcap G|$ where $|G|$ is the cardinality of the set $G$, and $\bigcap G = \bigcap \{X_{...
As I understand it in dataflow programming, programs are structured as directed graphs, an example of which is below Is it true to say that the arrows (or edges) represent the variables within a program and the vertexes (blue circles) represent programmatic functions? Or is this too much of a simplification? I am inte...
I have seen some implementations of Pollard's P-1 algorithm where the upper bound is only increased by 1 if no factor is found. Such an implementation is described here. Is it sort of missing the point in terms of efficiency to only increase by 1, or is is it sill better than trial division for finding a factor? Is wha...
Is English Turing-complete? Intuitively it makes sense that English is Turing complete, since you can talk someone through building a Turing machine. But I also think there might be some operators used in programming that aren't used in person-to-person communication, at least in daily life. Also, what level of English...
Suppose, we want to rearrange all possible $n$-bit binary strings (i.e., we have $2^{n}-1$ possible strings) in a 1-D array $X$; given that stings with smaller hamming distance should be placed as much closely as possible. Is there any algorithm to find the best solution efficiently? Note: I belive, for this problem, w...
I am currently studying for my exam and I am having trouble to solve this question: Right or wrong: If $A$ is context-free then $A^*$ is regular. I think it's wrong because if $A$ is context-free it means that $A$ can be a non-regular language. And the non-regular languages are not closed under the Kleene star operat...
I'm looking for an $NP$-hardness proof for the following variant of $SAT$: $$ EVEN-SAT = \{\langle \phi \rangle: \phi \text{ has an even number of satisfying assignments}\} $$ I've been playing around with gadgets for a while, but I haven't been able to construct a reduction. Still, I feel like there should be one. Hel...
While reading Compilers by Alfred Aho, I came across this statement: The problem of generating the optimal target code from a source program is undecidable in general. The Wikipedia entry on optimizing compilers reiterates the same without a proof. Here's my question: Is there a proof (formal or informal) of why this...
Please forgive me if this question is trivial, I couldn’t come up with an answer (nor finding one). In order to show that there are boolean functions $f : \{0,1\}^n \rightarrow \{0,1\}$ which can be computed only using circuits of size $\Omega(2^n/n)$, we use a counting argument: there are at most $O(2^{k \log k})$ cir...
Are there polynomial-time algorithms whose input is global but output is local in nature? What I have in mind is a problem instead of an algorithm. It’s the satisfiability (SAT) problem. Each clause is global information, because it’s surrounded by a host of satisfiable assignments, or rather their inverses, in the sea...
For example, a valid number would be 6165156 and an invalid number would be 1566515. I have tried many times to construct a finite state machine for this with no success, which leads me to believe the language is not regular. However, I am unsure how to formally prove this if that is indeed the case. I tried applying t...
Let $\Sigma$ be an alphabet and let $L$ be a language over it with the following properties: if $w\in L$ then there exists $v\in \Sigma^*$ such that $wv \in L$ and for every $s\in \Sigma$ the word $wvs$ does not lie in $L$ $wv\in L$ then $vw \in L$ It is prefix-closed, i.e. prefix of any word is still in the language...
I can very clearly see "why" mu-recursion is a universal model of computation, i.e. why the Church-Turing thesis -- that any physically computable algorithm can be executed with mu-recursion -- holds for mu-recursion. It reflects exactly the type of algorithms that I can carry out with my own brain. I cannot see an ana...
Pardon the word play. I'm a little confused about the implication of the claim and hence the question. Background: I ventured into Category Theory to understand the theoretical underpinnings of various categorical constructs and their relevance to functional programming (FP). It seems (to me) that one of the "crowning ...
I discover this in All NP problems reduce to NP-complete problems: so how can NP problems not be NP-complete? If problem B is in P and A reduces to B, then problem A is in P. Problem B is NP-complete if B is in NP and for every problem in A in NP, A reduces to B. Problem C is NP-complete if C is in NP and for some NP...
I had a question about random shuffling. Given a sorted list, is it possible to design an algorithm to return a uniformly random arrangement of the items in a deque with the following operations: read from list and add to front of deque read from list and add to back of deque remove from front of deque and add to back...
Consider $n$ sets, $X_i$, each having $n$ elements or fewer, drawn among a set of at most $m \gt n$ elements. In other words $$\forall i \in [1 \ldots n],~|X_i| \le n~\wedge~\left|\bigcup_{i=1}^n X_i\right| \le m$$ Consider the complete graph $G$ formed by taking every $X_i$ as a node, and weighing every edge $(i,j)$ b...
I am quite new to master theorem and I would like to ask the following question for $$()=4(/4)+20.$$ If there is a constant value like $20n$ does it affect the equation? Would the equation look something like this for test case 1: Is $f(n) = 20n \in O(n^{log_ba-\epsilon}) \in O(n^{\log_4^4-\epsilon}) \in O(n^{1-\epsil...
What is the correct way to solve the following recursion: $T(n)=T(\lceil\frac{n}{2}\rceil) + T(n-2)$ Or basically any recursion that has two parts which converge in a different rate. I'm trying to get big $O$ approximation, as tight as possible, but I couldn't figure it out with any "traditional" approach.
Given a grammar $G$ for a Context Free language $L$, we can augment it by "shuffling" the right hand side of each production, e.g.: $A \to BCD$ is expanded to $A \to BCD \; | \; BDC \; | \; CBD \; | CDB \; | \; DBC \; | \; DCB$ It may happen that the resulting language $L'$ generated by the expanded $G'$ is equal to $L...
In de Oliveira and Cook's Extensibility for the Masses uses Java for its code (it's not about stuff specific to that language though) and the ability to create anonymous inner classes is used extensively, starting from the code in Figure 4. Yet the authors claim that they rely only on a modest set of features and the s...
Prove that $L=\{a^ncb^n| n \in \mathbb{N}\}$ is not regular. Here is my try, I would really appreciate if someone could tell me if this is a correct proof. Proof: Lets assume L is regular. Then we know that L must meet the requirements of the pumping lemma. So let p the pumping number. Let $w=a^pcb^p$. $w$ is obvious...
Say you had (0,0,0,1,2,3,4,5,6,7,8,9,10) or (0,1,0,1,0,1,2,3,0,1,0,0,1) Could you use, for example, the KMP algorithm to deduce the validity of the above lists as prefix functions? I know there is a way to find whether a substring exists in a string using KMP, but is there a way to do it the other way around, starting ...
I'm wondering what's the answer of the following question: What is the maximal difference between the depths of 2 leaves in an AVL tree? Intuitively I think that it shouldn't exceed $log n$ but have no idea how to prove that. On the other hand, I saw multiple articles that claim the depth can become larger and larger w...
The standard Post Correspondence Problem concerns tiles with two rows of symbols, and whether a tile arrangement can be made so that the sequence of the top symbols of the tiles is equal to the bottom one. Let $\text{n-PCP}, \text{n} > 0$ a generalization of the Post Correspondence Problem where the tiles contain $\tex...
I'm trying to understand implications of translating between functions and languages for P/Poly complexity. I'm not sure whether the following all makes sense. Giving it my best shot given my current understanding of the concepts. (I have a project in which I want to discuss Hava Siegelmann's analog recurrent neural ...
Suppose we are playing the game hangman. My opponent and I both have access to the dictionary during the game. My opponent picks a word from the dictionary with knowledge of the algorithm which I will use to guess his secret word. Once my opponent has picked a word, I am given only the length of the word. I can guess a...
So I was supposed to prove with the help of Rice's Theorem whether the language: $L_{5} = \{w \in \{0,1\}^{*}|\forall x \in \{0,1\}^{*}, M_{w}(w) =x\}$ is decidable. First of all: I don't understand, why we can use Rice's Theorem in the first place: If I would chose two Turingmachines $M_{w}$ and $M_{w'}$ with $w \neq ...
A central processing unit offers to handle various operations like calculating, watching movies, making presentation etc. While a graphics processing unit is majorly used for the purpose of video rendering or playing of high-quality graphical games. I found the above statement on a website listing the differences betwe...
Let's say Bob wants to send a particular binary sequence to Alice. Imagine that Bob and Alice both have powerful machines but slow Internet connections. Bob could just send the sequence directly but the upload and the download would take a lot of time. Instead Bob could send a program that outputs the sequence. Assume ...
Let $A\in RE$, and define$f(A) = \{y |\ y= f(x),\ x\in A\}$ for some computable function $f$. Then $f(A)\in RE$. I can't figure out why this is true. Since $f$ is computable there is a Turing machine that computes it, denote it by $M_f$. Since $A \in RE$, we get another machine that accepts $A$, and obviously $f(A)$ is...
My problem is as follows: I have a set of shifts at various locations that need to be filled by tutors. A simple example would be basic math in room A on M, W, F from 9-11am and Sa from 12-3 pm. Locations can have a priority. Skills can have a priority. Tutors have a set of times when they are available. Tutors set a m...
As sensors only sense continuous quantities whereas an ADC is a device which actually converts one form of input to another.
This happens to me from time to time: I compile my code with the highest optimization level (-Ofast) of the allegedly fastest compiler (GCC) of one of the fastest languages (C/C++). It takes 3 seconds. I run the compiled program, measuring performance. Then I make some trivial change (say, marking a function inline), c...
Given a connected graph, with weighted edges, a virus starts from a given node. It takes x seconds for the virus to travel from a node to one of its neighbours where x is directly proportional to the weight of the edge. If you are allowed to remove one edge from this graph in order to maximize the ammount of time it ta...
Given a connected DAG I know how to compute the number of paths between two nodes. See e.g. Counting number of paths between two vertices in a DAG . Is there a reference or name for the algorithm? If not, are there well known applications?
I want to prove that $L=\{\langle M \rangle |L(M)\text{ is undecidable}\}$ is undecidable I am not sure about this. This is my try : Suppose L is decidable. Let $E$ be the decider from $L$. Let $A$ be a TM which is recognizing $A_{TM}$. Let $S$ be a TM which works on input $\langle M,w \rangle$ in the following way(the...
I want to prove that $$A \leq_p {\overline{A}} \Leftrightarrow {\overline{A}} \leq_p A$$. Does anyone have a Idea how to solve this ?
The question is quite simple; almost every computer language today provides the $\exp(x)$ function in their standard library to compute expressions like $ke^{-(x - h)^2}.$ However, I would like to know whether this function is the fastest way to compute the above expression. In other words, is there some way to compute...
Given a connected graph and two nodes s and t, there can be many different simple paths (without cycles) from s to t. Is there an efficient algorithm to find the average length of these paths?
Let $L$ be the languague which contains all satisfiable formulas which do not have the or symbol $\lor $. Or more precise $$L=\{\phi | \phi \text{ is a satisfable formula which is only using the junctors $\lor$ and $\neg$ }\}$$ Is $L$ NP-Complete ? I think it is NP-Complete. I can at least show that is in NP. A nondet...
Suppose that there is a server that has $n$ files. The server is used to construct a perfect hash function for those files and then the computed parameters will be sent to a user. These parameters will be used by the user to compute the hash of a certain file in order to find its position between files on the main serv...
The polygon above is actually a collection of a lot of black points closely packed together. I want to approximate these black points as straight line segments. The black points are not sorted in any order. What I'm doing right now is sort these points by selecting any random black point and recursively finding the ne...
I looked at the Cook's theorem at Wikipedia which presents a way to convert any NP problem to SAT but it seems to require O(f(x)^3) variables. Is it possible to remove some of the checks in the conversion so to make it O(f(x)*log(f(x))) in variables and time?
I would like to read some books (or any other material) that cover the design of randomized algorithms with a particular focus on the analysis. My main goal is to develop the rigour needed to construct the proof of correctness for such algorithms. I am currently reading Probability and Computing - M. Mitzenmacher, E. U...
I have a set $S = \{0,1,2,3,4,5,6,7,8,9\}$. $S_i \subset S$ for $i = {1,2,3,4,5}$. Any three $S_i$ has the same union, that is $S_1 \cup S_2\cup S_3 = S_1\cup S_2\cup S_4 = ...=S_3\cup S_4\cup S_5 = A$ and no $S_i\cup S_j = A$. What is lexicoraphical least of such $S_i$s? I have to write a Python code for this and I w...
Say I start with an iso with about 4GB of data and use this, to install windows on a computer. After installation, the operating system will take up about 40GB of disk space. Where does all this "extra" data come from? I mean, when all the information can be packed into 4GB, why does it need 40GB in the end?
In the paper Comparison Based Sorting for Systems with Multiple GPUs, the authors describe the selection of a pivot element with respect to the partition on the first GPU (and its mirrored counterpart on the other GPU-partition). That pivot element is crucial for being able to merge the two partitions, given that we ha...
I am trying to design an algorithm for a problem, and the following is an auxiliary problem for which a good solution would imply a faster algorithm for the original problem. I am given access to an array of numbers. However, I am only allowed to query it by specifying an arbitrary subset of indices, in response to whi...
I am very new to Computer architecture. I am thinking to add one more output register to this 4 bit CPU as shown below. However, I am not sure should I connect the output register to the current CPU. Should I connect it just the same way as the current one and label the 2 output register as output A and output B? But i...
I know this is probably a really basic question but I just cant wrap my head around it right now. So the basic PSO update formula is as follows: $$\bar{v}_{n+1} = \omega \cdot \bar{v}_n + c_k \cdot r_1 \cdot (\bar{p}_{best}-\bar{p}_n)+ c_s\cdot r_2 \cdot (\bar{g}_{best}-\bar{p}_n) $$ velocity(n+1) = momentum_component ...
I read the following argument showing that not every language is described by a grammar: For a fixed alphabet $\Sigma$ and variables $V$ there are uncountable many languages over $\Sigma$ since the power set of $\Sigma^\ast$ is uncountable. But grammars are finite objects by construction and thus there are only counta...
Let $X = \{1,2,\dots n\}$, and $Y_i= \{T \in \mathcal{P}(X): |T| \le i\}$. I am interested in "avoidance sets" $A \subset Y_n$. We say a subset $S \subset X$ is valid with respect to an avoidance set $A$ if $T \not \subseteq S$ for all $T \in A$. We let $f(A)$ denote the set of $S\subset X$ that are valid with $A$. It ...
I am working on floor planing on small orthogonal grids. I want to partition a given $m \times n$ grid into $k$ (where $k \leq nm$, but usually $k \ll nm$) connected components in all possible ways so that I can compute a fitness value for each solution and pick the best one. So far, I have the fitness evaluation at th...
Given a tree of "N" nodes(each node has been assigned a value A[i],node-"1" is the root of the tree), and a constant "K" , we have Q queries of the following type : [w] (which means find the lowest valued node in the sub-tree of [w] , only considering those nodes in the sub-tree of [w] which have a depth less than equa...
Currently I have this 4 bit CPU as shown in the schematic diagram below. What I wish to achieve: Add one more output register to make the CPU output a total of 8 bits Show alphabet using the 8 bits output My current trial: Cout of the first IC connected to Cin of the second IC Cascaded in a synchronous fashion Wh...
I am having trouble understanding the conceptual meaning of the two kinds of analysis. I know the equations and how to solve the problems and I know how one is a forward data-flow analysis while the other is a backwards data-flow analysis, but there is still something missing in the explanations I have seen so far, in ...
I have forgotten how to do this. How do I figure out what the requirements are for a 128-bit string using a certain alphabet? That is to say, I want to generate a UUID (128-bit) value, using only the 10 numbers for the alphabet. How many numbers do I need, and what is the general equation so I can figure this out for a...
I came upon this particular question which I do not understand from Jeff E. Algorithms, Chapter 9, ex. 8. https://jeffe.cs.illinois.edu/teaching/algorithms/book/09-apsp.pdf How can we remove any arbitrary vertex from a directed graph, with weighted edges that can be positive negative or zero, without changing the short...
I am programming a CNC machine (using matlab). In order to generate a surface with a "high" shape accuracy (order of $1\mu m$) and "small" micro roughness (order of few nm) I need to make sure that no large acceleration/decelerations takes place, because this would induce vibrations. If the amplitude of these vibration...
Does every thread have its own main function? I know that its have its own stack, but what about main function (not necessarily a function which called main). For example, when creating a thread, we pass a function as an argument for the new thread to run it. I tried to search about this topic, but couldn't find answer...
Short Version: How can we construct a trie which maps abbreviations of names-of-the-month to full-month (we map the abbreviation "mar" to "march")? The set of all abbreviations is formed by: keeping the first letter of the month name. (all abbreviations of "january" begin with "j") deleting 1 or more characters ("ja...
I was going through section of Breadth First Search of the text Introduction to Algorithms by Cormen et. al. and I faced difficulty in understanding a statement in the proof below which I have marked with $\dagger$ Theorem: (Correctness of breadth-first search) Let $G = (V, E)$ be a directed or undirected graph, and s...
I have been learning graph algorithms, and the concept of dynamic programming is quite succinct. However, I read that Bellman Ford is a form of dynamic programming. I am not sure why since given so many unnecessary re-computations, it is not exactly efficient in the likes of other dynamic programming that computes the ...
I am implementing a Merkle tree and am considering using either of the two options. The first one is sorting only by leaves. This one makes sense to me since you would like to have the same input every time you are constructing a tree from the data, that might not arrive sorted by default. CAB / \ ...
I know how to prove that CFL are closed under kleene star operation using CFG. I can't find online or in class notes a proof using PDA. I would appreciate description of the basic idea (not formal).
Suppose we have a graph $G$ with $n$ vertices. Suppose LP is a linear programming problem where there is a variable for each vertex of $G$, each variable can take value $≥0$, for each odd cycle of $G$ we add to LP the constraint $x_a+x_b+x_c+\dots +x_i≥1$ where $x_a,x_b,x_c,...,x_i$ are the vertices of the cycle. The o...
I have some questions about Pi Calculus: How to simulate the natural numbers only with its primitives? It's possible simulate the if else clauses without the sum (+)? A minimal and standart example would be interesting.
I am using the CPU-OS simulator by Besim Mustafa(https://www.merlot.org/merlot/viewMaterial.htm?id=476196) and I am studying Pipeline Stages. I have written a simple program and captured the metrics like CPU Clocks, CPI, Instruction Count, Speed Factor. My question is what changes should I make to improve the CPI and S...