instruction
stringlengths
35
11.4k
I'm just a little confused about the wordings for reductions and would appreciate some help as I am very new to reductions. I have a question where I have two sets, A and B, and I have to provide a reduction A $\leq_p$ B and then I have to prove that the reduction is correct. What does this mean exactly? For the redu...
I have an assignement where I need to use a Genetic Algorithm to solve the TSP (Traveling Salesman Problem). I alrerady implemented a solution in C# but the problem is we're asked to use some kind of method to do the Parameters Tunning (For example to pick the population size, mutation rate, etc..). For now, I only try...
Are Brute Force Algorithm and Exhaustive Search both references to the same ideas?
I have gone through a list of scheduling algorithms and their implementation, however couldn't find any reference to implement an algorithm that solves the following problem. Given an array of processes having n process, the i'th process being represented by: Arrival[i] representing its arrival time, Depart[i] represen...
I am studying Computer Graphics and need to design an incremental algorithm for solving the polynomial $y = ax^3 + bx^2 + cx + d$, and then implement that in OpenGL. The input will be the values of $a, b,c,d$ and the desired output is a line/curve to be drawn. The values of $x$ would be in the range $1\leq x\leq100$. T...
To prove that a certain problem is in P we have to give an algorithm that decides or solves it in polynomial time. To prove that a problem is in NP an algorithm must exist so that it can check whether a certain input is a solution to the problem in polynomial time (validate the input). I am very confused as to how we ...
(Note: this was asked in the cstheory stackexchange, but I was told this is a more appropriate place for it.) I have three 8-bit 2's-complement numbers (X, Y, and Z). I want to find a propositional logic formula using only the variables (x1, x2... x8, y1... y8, z1... z8), where xi is the ith bit of x which expresses th...
I know that finding a Hamiltonian circuit is in NP and I know that finding an Eulerian circuit is in P. However, what about the following problem: Must leave the starting vertex and visit every other vertex; You may only return to the start after visiting every other vertex; You can visit the same vertex multiple time...
Prompt: if $N$ is NFA that has at most one choice of state for any state and input symbol, then the DFA constructed from $N$ by subset construction has exactly the state and transitions of $N$ plus transitions to new dead state whenever $N$ is missing transition for given state and input symbol. Prove this contention. ...
My professor gave the reduction of Independent Set (IS) $\leq_p$ SAT where SAT is the set of all satisfiable propositional formulas in conjunctive normal form, and IS the set of all pairs (G,k) where G is an undirected graph with an independent set of size k, given as as an exercise and I'm a little confused as to what...
I'm considering the following definition of one-way functions: Let $f : \{0,1\}^k \rightarrow \{0,1\}^k$ and $b : \{0,1\}^k \rightarrow \{0,1\}$ be computable in poly($k$) time. We say that $f$ is a one-way function with hard-core bit $b$ if, for all polynomial-time randomized algorithms $A$ and all constants $c$, $...
I'm sure this problem has been addressed before, but I'm unable to find an exact description of it. I have $m$ machines, and $n$ tasks that need processing. Each task takes a variable amount of processing time, $t_i$, but this processing time is constant regardless of which machine processes it. Each task is also assi...
The problem I am working on is the following: Show that there exists an $NP$-Complete problem in $SPACE(n)$. Does the existence of such a problem imply that $NP$ is contained in $SPACE(n)$. Why or why not? $SAT$ is contained in $SPACE(n)$. To show that, simply store Boolean formula (takes $O(n)$ space) and try a...
In the below diagram, each node takes up a space of 2KB. I need to find the total memory consumed to reach the goal : I I know that the equation for BFS is b1 + b2 + ...... + (bd+1 - b) Where b is the branching factor and d the depth But how do I calculate the branching factor in the below diagram, where the branches a...
Let $G$ be a finite group given by the table representation and a normal subgroup $H$ of $G$ is given. I want to compute $G/H$ that is quotient group. Model of computation is RAM For all pair of $a$ and $b$ in $G$ just check $a.b - b.a = 0$ , but it is going to take much time $O(n^2)$. Is there a faster algorithm to s...
Does every language $C$ in the class $BPP$ have a mapping reduction to $A_{TM}$? $(C\leq _{m} A_{TM})$ $BPP$ is the class of languages that have a probabilistic $TM$ that accepts them with an error $\epsilon$ less than 1/3. $A_{TM}$ is the acceptance language, takes as input a $TM$ description of $M$ and a word w, then...
I'm about to study a system that takes words in a formal language $L$ and converts them into words in a different formal language $L'$. In other words: a formal language transformer. I was wondering if there is literature on formal language transformers, some standard way of studying, and defining them? All I found are...
I'm reading Operating System Concepts by Avi Silberschatz(9thE), in section 11.4 File-System Mounting, the author explains the steps of filesystem mounting as follows: The operating system is given the name of the device and the mount point—the location within the file structure where the file system is to be att...
An 8-way set-associative cache is used in a computer in which the real memory size is 222 bytes. The line size is 16 bytes, and there are 26 lines per set. A) What is the size of the cache in bytes? What I (think) I understand: Cache line and cache block are synonymous. The textbook says that an n-way set-associative...
Why is there a need to scan each root node of the binomial trees in a binomial heap to find the minimum? For example, why can't the true root of the binomial heap, the one that leads to the root nodes of the binomial trees, be the minimum? If it is not the minimum, then what value should it be?
If X is in NP-complete and complement(X) is in NP, show that for all Y in NP, complement(Y) is also in NP. I am struggling with figuring this out. I know this means Y can be reduced to X, so if I could solve X I could solve Y. I can't solve X, but I have a certifier for X and complement(X). I am having trouble combinin...
In class we have learned that division takes O($k^2$) where k is the bitlength of the numbers used in the operation. What would be the runtime of a function that looks like this? while a % 2 == 0: a = a / 2 I am guessing the worst case is $O(log(k)k^2)$ as a decreases by 2 each time but each division takes $k^2$
When compiling a piece of software (with LLVM for exmple), you first transform your code into some kind of intermediate representation (IR code). This IR code needs to be converted to your target specific assembly code. When we have a fixed processor architecture, often optimizations are made to make the machine run a ...
This "research vignette" (whatever that is) claims that the polynomial hierarchy classifies problems according to a natural notion of logical complexity, and is defined with an infinite number of levels: problems at the zeroth level are the “easiest”, and for every integer $k$, problems at the $(k+1)$-st level have lo...
I read few papers while trying to find some better approachs to solve the TSP (Traveling salesman problem) as close to the optimal solution as possible. I implemented a Improved Greedy Crossover (https://arxiv.org/ftp/arxiv/papers/1209/1209.5339.pdf) and I saw in the same paper that he uses the 2-opt heuristic (and the...
Let $G=(U \cup V, E)$ denotes a bipartite graph. A biclique $C = (U, V)$ is a subgraph of $G$ induced by a pair of two disjoint subsets $U' \subseteq U$, $V' \subseteq V$, such that $\forall u \in U', v \in V': (u, v) \in E$. Given $\delta$, I'd like to identify bicliques $(U',V')$ such that $|V'| \ge \delta$. Since ...
Suppose I have a collection of N items, each of which has A different attributes, a1, a2, ..., aA. Attribute ai can take on Vi different possible (discrete) values, distributed across the population with some kind of complicated joint probability φ(a1, a2, ..., aA). It is quite likely that many possible combinations ...
What is the most complicated kind of deterministic finite-state automaton that can be minimized in $O(n)$ time? Here’s what I’ve been able to find so far: The acyclic case has been solved. So any acyclic DFA can be minimized in $O(n)$ time by the Revuz algorithm [2]. As for cyclic automata, an automaton that is a simp...
As an assignment, I've to come up with constructive proofs for the following languages to be regular supposing A and B are two distinct regular languages. $$L_1=\{w│w^R∈A\}$$ $$L_2=\{w│w=a_1 b_1,…,a_k b_k;a_i∈A,b_i∈B\}$$ $$L_3=\{xy│yx∈0A\}$$ $$L_4=\{w│w∈A,∄y∈B:w=xyz for some x,z∈Σ^* \}$$ $$L_5=\{w│∃x∈B:wx∈A\}$$ I've al...
This proof is from Introduction to Automata Theory Languages and Computation by Hopcroft & Ullman and is regarding a 'bad case' for subset construction. The NFA which is being converted is as follows: The argument for this then goes as follows: Consider the NFA N of Fig. 2.15. $L(N)$ is the set of all strings of $...
I am learning Shamos's rotating calipers algorithm for finding the diameter of a convex polygon in his Ph.D. thesis; Page 78. It reads Consult Figure 3.23 and notice that parallel lines of support cannot be made to pass through every pair of points. For example, no lines of support through vertices $D$ and $F$ can be ...
I'm new to computer vision and I have a common question that I couldn't figure out with Internet or books. As I understood, in general, there are two main approaches in modern computer vision: neural networks based methods and more "classical" methods that use feature extration (edges, keypoints, gradient and etc), lik...
Given a finite set $S$ of points in $\mathbb R^d$, how can we efficiently compute a "most isolated point" $x\in S$? We define a "most isolated point" $x$ by $$x = \arg\max_{p \in S} \min_{q \in S \setminus \{p\}} d(p,q)$$ (I used the $x=\arg\min$ notation even though it is not necessarily unique. Here $d$ denotes the ...
Suppose that we have a CNF SAT instance where each clause contains all variables (i.e. in each clause for each variable either the variable or its negation is presented). Such problem can be trivially solved, since any such instance either contains all possible clauses or is satisfiable. Question: is there some a simil...
I want to compare swarm intelligence algorithms in a optimisation problem. As far as I understand, a typical approach is to perform several runs of each algorithm (say 30 independent runs, with different random number generator seeds) and compute the average performance of best-of-run individual for each algorithm. Th...
Hash tables perform lookup, insertion, and deletion in O(1) time (expected and amortized) while the different variants of binary search tree (BST) - treap, splay, AVL, red-black - offer at best O(log n). So, in a course on data structures, is the study of BST's of any value except as a historical note?
When we have a decision problem, " does $f(x)=1$ hold?", we call the set of strings $x$ for which the answer is yes a "language". Why this strange terminology?
$A\leq_p B \iff \bar{A}\leq_p \bar{B}$ (if A is polynomial time reducible to B does that imply that complement of A is polynomial reducible to complement of B) I was told that this is the case based on the definition of $\leq_p$ but I am having trouble proving this.
I've heard that C++ and Python where implemented using C. How can someone make an object oriented language out of something that doesn't support objects? I've read in the book "Math You Can`t Use - Patents, Copyright and Software" that code is considered an equivalent of mathematics because it will eventualy be ran on ...
There are several pseudorandom number generators that we have no known polynomial time algorithms for inverting (finding the initial seed). Is it correct to say that inverting these generators is an NP problem?
Suppose we are given a set of agents (say $P_1 , \dotsc, P_M$), an undirected graph G(V,A) and a set of initial vertices on $G$ where each agent is located. Initially only the edges connected to these initial set of vertices are globally known to all agents. At each step, the agents can traverse an edge connected to t...
I could of course construct a truth table for the function $$f(x) = \left(\sum_i x_i\right) \leq k$$ Where $x$ is an assignment and I'm slightly abusing notation to count Booleans. And then I could make a formula from that. But if there are $n$ variables then this truth table will have $2^n$ rows, rather unwieldy. Even...
Theorem 11.4 For any constant $\delta > 0$, every problem in NP has probabilistically checkable proofs of length poly($n$), where the verifier flips $O(\log n)$ coins and looks at three bits of the proof, with completeness $1-\delta$ and soundness $1/2+\delta$. Moreover, the conditions under which Arthur accepts are...
I have heard whisperings that if we have a turing machine that is allowed to compute infinitely many steps in finite time, then we can solve the halting problem. This made me wonder, if we have such a TM, do Godel's incompleteness theorems then not hold anymore? My intuition is: If the TM can make an infinite amount of...
Consider the code $C=\{c=(c_1...c_n): c \in \Bbb F_q^n, c_1=c_n\} \subset \Bbb F_q^n$. I was able to prove that the code is a linear code because it is closed under addition and scalar multiplication. Also, it is clear that the length is n. However I am having a hard time with minimum distance, dimension, and size. F...
We solve Matrix chain multiplication problem considering the optimal solution to subproblems but what I cant get through my mind is how this problem has an optimal substructure? For eg. consider if these are optimal solutions for matrices A1.A2.A3.A4.A5.An: (((((A1.A2)A3)A4)A5)A6)An) (((((A1.A2)A3)A4)A5)(A6.An)) If ...
I have to write an algorithm for a following problem. I have a function that has 2 parameters: an array of 32 bit unsigned whole numbers - bit vectors [ARR] and distance[dist]. We need to find how many 32 bit numbers x there are such that they are differing from each of the bit vector for the most dist bits. Example: W...
I am working on a small project. The goal is to implement a compiler from a quite simple, custom syntax of logical formulae (including variables over finite domains) to conjunctive normal form (CNF). The compiler should for every formula $\varphi$ from the custom language produce a standard propositional formula in con...
Gödel's first incompleteness theorem states roughly that "for any axiomatization of arithmetic, there are statements that can neither be proven to be false nor true." Does this still hold when it comes to quantifier-free statements? I.e. if we have the structure of arithmetic: $(\mathbb N, +,\cdot, 0,1)$, and we restri...
Suppose I have two union-find trees with roots $x$ and $y$ respectively. I want to join them in constant time (this is normally possible since I already "hold" the roots) but I need $x$ to be the root of the merged tree. I don't know what rank $x$ or $y$ have (or more precisely formulated I need this to work always - f...
I need to write a function that gets an array of bytes at the input and 2 integers (minDist and maxDist). The calculation algorithm understands this field as a bit sequence starting from the LSB (least significant bit) of the first byte and ending with the MSB (the most significant bit) of the last byte. Therefore, for...
Given a list of $n$ non repeating integer numbers $L:=(x_1,\dots,x_n)$ develop an algorithm that decides if there are $x_{i_1},x_{i_2},x_{i_3}\in L$ such that $i_1<i_2<i_3$ and $x_{i_1}<x_{i_3}<x_{i_2}$. Only a yes-no answer is required. The statement also suggest to use the "divide & conquer" strategy. My try was th...
Is there a cryptographic (or even not entirely cryptographic) way of exchanging objects between Alice and Bob that would not require a third party, and Alice and Bob would not need to trust each other? For example, Alice and Bob have Y and X objects (some information) and want to exchange them (in other words both Alic...
I have a field $X$ of given length $n$ which is filled with zeroes in the beginning. I only need these 3 simple operations: GET_VALUE$(i)$: returns the value of $i$-th cell ($X[i]$) SET_TO_1$(i)$:basically $X[i] \leftarrow 1$ for $i < n - 1$, otherwise nothing (the last cell of $X$ is always zero ($X[n-1] = 0$)) FIND$...
I'm going over the different types of attributes in data-mining (nominal, ordinal, discrete, etc) and there is one example in the book that states that the density of a substance in grams per cubic centimeter is a discrete attribute. Why is this? I confuses me that this is the case but it also says that the distance fr...
I am making a webapp that alerts when product prices fall or rise above a number. Let's say a product costs 100 and the user wants to be alerted when it reaches 80, the prices change every hour or so and I need to trigger all the alerts. What is the best way for this to make this work. What I have tried so far? Approac...
what is the Big O for Returning List? aka return list (e.g. list=[1,2,...]) is it o(1) or o(n) and is there a good website for average big o for different operations including sorting for simple types like list or arrays, etc.
Let B={M1,M2,...} be a Turing-recognizable language consisting of TM descriptions. Show that there is a decidable language C consisting of TM descriptions s.t. every machine in B has an equivalent machine in C and vice versa. I saw a hint on solving this question which is given in the following picture: But I have a d...
I have an essay question and I just want to make sure I have things right. 2 trains need to be able to communicate with eachother at any time. Based on research i've settles on a wired network running along the tracks, with wireless access points. These converge on a central location which houses the switches/router t...
Is it possible for a $DFA$ which has $n$ states that, there exists two distinguishable states $p, q$ such that there exists a distinquishing string between $p$ and $q$ whose length is greater than $n$?
I'm currently studying the Bakery Algorithm. I understand it for what it is but now I want to switch it up a bit. If we changed the < in the 2nd while() loop to ≤ what exactly would happen? My take: I don't think it'll cause starvation but I think I'm wrong. Thanks for taking the time to read. do { choo...
The language $\{w \mid w \in \{0,1\}^{*}\text{ and }M_w\text{ accepts infinitely many inputs}\}$ is undecidable, where $M_w$ is the Turing machine represented by $w$. I am confused because I do not know how to reduce this problem. Maybe it works with the complement of the Halting problem?
How to prove for all $i\in\mathbb{N}$, there exists a language $A\in\mathrm{EXP}$ such that no family of boolean circuits of size $n^i$ decides $A$? I have a reminder that says $$ \mathrm{EXP} =\bigcup_{c\in\mathbb{N}} \mathrm{DTIME}\left(2^{n^c}\right). $$ Thought of building a TM that on input $x$ of size $n$, finds ...
Based on this video, the tutor explains the knapsack problem with dynamic programming approach. One thing is not cleared in this video, which is my main question. All the values on the first row (except 0) are set to 1 because value and weight (on that row) are 1 hence, we cannot exceed that number Below is the compl...
Apologies for the newbie question, but I am a bit confused about what exactly counts as a "simple operation" when working out the time complexity of an algorithm. In particular, why do we consider all operations to be equal? Surely, dividing two very large numbers is more time-consuming than adding one to a number (as...
It's often regarded that the most intuitive answer to the question of $P$ vs $NP$ is that $P ≠ NP$. This is often illustrated with some consequences that would follow if $P = NP$ were true. Things like being able to find a proof for the Goldbach conjecture in polynomial time (if one exists), and so on. However, are the...
Show that the single-tape TMs that can not write on the portion the portion of the tape containing the input string recognize only regular languages. The first part of the answer in a book said that: We give a DFA $A$ that is equivalent to TM $M$. Design $A$ in two stages. We arrange the states and transitions of $A$...
As said in the title, I have to generate an AST from a grammar and logic (or a"syntax" if you prefer). This grammar and syntax are both indefinite in the program, meaning that it is the user (a developer in this case, because it would not be useful to a"normal" user) must write what it takes in a file for the program t...
I am going through the text from "R.Brachmann and H.Levesque: Knowledge representation and reasoning". Here it has been described(in page 15) that there are two types of symbols : the logical symbols and the non logical symbols. Logical symbols are the ones that have a fixed meaning and the non logical ones are the on...
Having a graph and all of it's strongly connected components, I was wondering what the most efficient way to find arcs that connect two SCC. All the solutions I found involve running through all the nodes, and I was wondering if there was a way to do it without having done that, in particular, during the Tarjan algorit...
I've seen competing requirements in the definitions for one-way functions. Namely $$ \underset{x,r}{\mathbb{P}}\big(f(B(f(x),r)) = f(x)\big) = o(n^{-c}) $$ and $$ \underset{x}{\mathbb{E}}\left[\underset{r}{\mathbb{P}}\big(f(B(f(x),r)) = f(x)\big)\right] = o(n^{-c}) $$ where $x\in\{0,1\}^n$ and $r = \text{poly}(n)$. $B$...
I would like to implement Conway's game of life on a grid that is infinite in all directions. It should be initialized with an initial pattern and then run, e.g, like this: set(-500,200) set(-501,201) set(-502,202) start() What data structure should I use? Matrices usually start with (0,0). One solution is to keep tra...
We all know the algorithm that solves the Generalized Geography problem using polynomial space (it's described on wiki). My question is: what is the time complexity of this algorithm? I'd like a more precise answer than just 'polynomial'. As far as I understand, we're making $|V|$ calls at most? We won't call the funct...
Suppose that I have a restricted Turing Machine - it has finite tape and takes bounded input. Consider a program that halts on every input (which is at most $k$ bits). The set of inputs is finite, therefore the function describing running time is bounded and hence is $\mathcal O (1)$. Therefore, when analyzing any alg...
I've started learning cryptography in class and we've come across One-Time-Pads, in which the key (uniformally agreed upon) is as long as the message itself. Then you turn the message into bits, do $XOR$ and get the cipher text. This encrypts the message and to decrypt the message you'd do $XOR$ with the cipher and ke...
So I was reading Micheal Sipser's Introduction to TOC and when I stumbled upon this aforementioned question , he'd the following dfa : Now, I came up with a much better DFA with only 4 states : I read in another thread that the minimum number of states for a DFA for this language is 8. But , I came up with 4. Where ...
I'm taking an artificial intelligence class and in one of the recent lectures the topic was local search algorithms, more specifically Hill Climbing. At one point the professor showed the classic 8-queens puzzle to illustrate the algorithm working, he stated that in it a queen can only move one row up or down, so for e...
I have been reading about compilers and it is said that doing the data flow analysis in the basic blocks is more optimal. Sadly, quoting the exact source, would be slightly hard as it is not in English, but a quote from wikipedia can also be used: Data-flow analysis is the process of collecting information about the wa...
I'm trying to count the number of subsequences of a long string. e.g. BANANA -> B, A, N, BA, BN, AA, NN, NA, BAN, BAA, BNA, BNN, ANA, AAA, NAN, NNA, etc There's the horribly inefficient way, which is to iterate all of the substrings and keep hash of some sort to keep track of the ones already seen. The size of the hash...
I understand that every regular language can be generated using either a right-linear or left-linear grammar, however, does that go the other direction? In other words, do there exist any context-free grammars that are not regular that are either right or left-linear?
Prove that the language $L_1 = \{a^ib^{2i}c^j \;|\; i,j ≥ 0\}$ is context-free. I have a grammar like this but there are some strings that are not be able to be generated $$\begin{align} S &\to aSbb \;|\; C \\ C &\to cC \;|\; \epsilon \end{align}$$ One example is the string $abbc$ cannot be generated.
Let $G=(U \cup V, E)$ denotes a bipartite graph. A biclique $C = (U, V)$ is a subgraph of $G$ induced by a pair of two disjoint subsets $U' \subseteq U$, $V' \subseteq V$, such that $\forall u \in U', v \in V': (u, v) \in E$. I'd like to identify the minimum number of bicliques such that the nodes on one side of the b...
I don't know how to find a loop invariant. I'm not sure where to start. Can anyone find the loop invariant of the given program and explain your method please. {n ≥ 0 ∧ i = 0} while i < n − 1 loop b[i] := a[i + 1]; i:=i + 1 end loop {∀j.(0 ≤ j < n − 1 → b[j] = a[j + 1])}
I've seen competing claims about hard-core predicates. On the one hand, there's the basic definition Let $f : \{0,1\}^n \rightarrow \{0,1\}^k$ and $b : \{0,1\}^n \rightarrow \{0,1\}$ be computable in polynomial time. We say that $f$ is a one-way function with hard-core bit $b$ if, for all randomized algorithms $B$ and...
Subset sum can be solved with dynamic programming in pseudopolynomial time O(mn) which is subexponential. And, of course, subset sum problem is NP-complete. Why doesn't that contradict the Exponential time hypothesis?
I am learning multi paxos from the slides of this made by John Ousterhout and Diego Ongaro. In this section talking about Full Disclosure, it says the acceptor mark entry 6 as chosen, since the proposer tells it, with the same proposal 3.4 and firstUnchosenIndex 7. My Question is: As you can see, proposal 3.4 is for e...
Let $M_1$ and $M_2$ be two deterministic finite automata with $M_1$ having $n$ states, and $M_2$ having $m$ states, over the same alphabet $\Sigma$. Show that if $M_1$ and $M_2$ are not equivalent, then there is some string $\omega \in \Sigma^*$ of length at most $n \times m$ that is in exclusively $M_1$ or $M_2$. It i...
I want to generate a dataset of binarized masks of scene-text images to use them to train a model. I have no previous experience in dataset synthesization especially related to font-rendering. Can anyone provide me some links to articles/blogs/related-github-projects?
So i know that it cannot be used if the directed graph has negative cycle, but what about the undirected graphs with negative edges? is it going to always work, or sometimes or never?
Is the following problem computable in polynomial time? Input: $<M_1>$, encoding of a determinstic TM that runs in polynomial time ($L(M_1)\in P$) Output: $<M_2>$, encoding of a determinstic TM that runs in polynomial time ($L(M_2)\in P$), and satisfies: $L(M_1)=L(M_2)$ (they decide the same language) $\forall n\exist...
I have 2 images of a scene taken at one moment by two identical cameras (similar cameras intrinsic parameters) by to arbitrary locations and at two arbitrary orientations (different cameras poses). On the images n points correspondence p_i1={x_i1, y_i1, z_i1}↔p_i2={x_i2, y_i2, z_i2}, i=1,2,...,n are given. Let for simp...
Given $n$ inputs and $k$ outputs and $j$ identical binary function calls to $g$, how many possible distinct single-assignment forms are there? The only assumption made about $g$ is that if $a = c \wedge b = d$ then $g(a, b) = g(c,d)$. Each SSA form consists of two parts. The first is a temporary assignment part: t1 ...
A few years ago I made a pseudo-random number generator to use in a monte carlo simulation for a lecture in my University. My instructor ask me why I did that generator instead of using C equivalent rand. The algorithm is $x_{n+1} = e^{x_n + k} \mod 1$ using float point values with $K$ big enough to contain a complete ...
I read the book "Introduction to the Theory of. Computation, Third Edition by Michael Sipser". It says: If a language is context free, then some pushdown automaton recognizes it. Let A be a CFL. From the definition we know that A has a CFG, G, generating it. We show how to convert G into an equivalent PDA, which we ca...
If we consider this tree with T1 and T2 as subtrees, and we want to rotate on x (rotating the edge between T1 and x), what is the result? how does it work then? Does the x stay in its place and T1 switch with T2? I saw multiple examples online but they had too many nodes and i couldn't really understand the concept o...
How would I reduce $A_{TM}$ to $CF_{TM}$ when: $A_{TM}=\{<M,w>|M$ is a Turing Machine description and $w\in L(M)\} $ $CF_{TM} =\{<M> | M$ is a Turing Machine description $L(M)$ is a context-free language.$\}$ My problem is this: $A_{TM}$ deals with all $TM$s how would knowing if some $TM$'s language is $CF$ help us kn...
Mr. Katsaros owns a rectangular olive grove divided into 5 rows and 4 columns. He notes down the amount of olives (pounds) possibly obtainable from each of 20 square sections. The picking starts from the furthest north-west section and ends in the furthest south-east section. What is the maximal amount of olives that c...
I'm looking for interesting applications of computing science for finding the probability of otherwise difficult problems. This is for an undergraduate level presentation in a probability course of around 30 minutes, from a comp sci major who has beginner to intermediate skills in both probability/statistics and comp s...
What's the best/optimal known method/algorithm known that can be used to calculate the number of binary $M_{m,n}$ matrices for given $n,m$, whose $1$'s are all connected? Or equivalently, to calculate the number of connected induced subgraphs of a grid graph. I'm aware of the computed values so far listed on $(n,m...
Let $$PATH = \{(G, s, t) | \exists \text{ a directed path from $s$ to $t$ in $G$}\},$$ $$EQ_{DFA} = \{(M_1, M_2) | \text{DFA $M_1$ and $M_2$ over the same alphabet are equivalent}\}.$$ Is there a log space reduction from $PATH$ to $EQ_{DFA}$? My attempt was to first show that there exists a DFA that accepts a string ...