instruction
stringlengths
35
29.1k
Say I have a finite state transducer, 6 tuple FST with a set of states, input symbols, output symbols, transition function, a start state, and an output function. If I combine the output function into the transition function and create this mutated FST called iFST, where the output happens on the "edges" and just one s...
For a simple linear search on an unsorted list my textbook says the following: To determine the average case, you add the number of iterations required to find the target at each possible position and divide the sum by n. Thus, the algorithm performs (n + n - 1 + n -2 + ... + 1)/n, or (n + 1)/2 iterations. The code ...
In Coin Change Problem, if the ratio of Coin Value ($\frac{Coin_(i+1)}{coin(i)}$) is always increasing then we can use Greedy Algorithm? Example- $(1,3,4)$ are denominations of coin. If I want to pay $Rs.6$ then the smallest coin set would be $(3,3)$. This solution set cannot be found by greedy Algorithm because it doe...
Let's say I have a problem (i.e. Given f(x), find x) and two neural networks(i.e. feedforward and recurrent). I would like to know if one works better than the other one. I could run the twos on a computer, but other programs might interfere and I wouldn't know if the implementations I'm running are really the best one...
A useless state in a finite automaton is one from which no path leads to a final state, hence no (piece of a string) is recognized out of this state. Theoretically, the algorithm to determine the useful states is trivial: Let $G$ be the set of good (useful) states and let $\Omega$ be the set of all states. Initialize $...
I'm still fairly new to Turing Machines, but I've been doing some research. I know that a Turing Machine can have an infinite tape and that it requires a finite number of states, but does it necessarily follow that a Turing Machine can have an infinite number of accept states? I keep seeing different layouts when forma...
How is n-times regex alternation operation, e.g. (0|1|...|n), handled in a DFA (MYT algorithm)? Here are the rules for the MYT also (Converting Regular Expressions to NFAs ): https://swtch.com/~rsc/regexp/regexp1.html
I was assigned as homework: Suppose we have a width-w balancing network of depth $d$ in a quiescent state $s$ called $B$. Let $n = 2^d$. Prove that if n tokens enter the network on the same wire, pass through the network, and exit, then $B$ will have the same state after the tokens exit as it did before they ent...
I was learning what balancing networks are and at some point the art of multicore programming talks about balancers. The text book says: A balancer is a simple switch with two input wires and two output wires, called the top and bottom wires (or sometimes the north and south wires). Tokens arrive on the balancer’s...
I'm trying to create a small program that interprets a NFA to the corresponding regex using Thompson's algorithm. My question: What kind of notation can be used to express a NFA (e.g. in the form of a string?) that can be read and then interpreted by the program?
Given a full binary tree, $T$ (each node is either a leaf or possesses exactly two children), with $n$ leaf nodes: $v_1,v_2,...,v_n$, and weights associated with the leaf nodes: $w_1,w_2,...,w_n$, the cost of the tree, denoted by $|T|$, is defined as: $$|T|=\sum_{i=1}^{n}w_il_i$$ Where $l_i$ is the depth of $v_i$ in $...
Not sure if I completely understand this problem that was presented in class. We were given function $$f(n) = 2*f(n-1) + n$$ The base case for all these functions $f(1)$ is equal to 1. Assume $T(x)$ is equal to the running time of $f(x)$. Recurrence of this algorithm is solved as $$T(n) = T(n-1) + 1$$ This is bounded b...
What is the idea behind proving that: Removing unreachable states from a DFA $M$ does not change $L(M)$. I don't know what cases I need consider. Consider any $w\in \sum^*$ and then check for the cases $w \in L(M)$ or $w \not \in L(M)$? Then I was thinking that there could some lemmas regarding DFA minimalization, so...
How is out-of-order instruction execution related to superscalar execution? How is data hazard detection and handling affected by superscalar execution?
In a certain robotics application, I encountered a problem in which we need to determine the order of positions of several robots on $\mathbb{R}$. Each measurement that we take of robot positions is subject to random errors beyond our control. I've formalised the algorithmic part of the problem as follows. This part ha...
The algorithm described here in "Linear Work Suffix Array Construction" (2006) has compact C++ code that is too abstract for me to follow. Is that still the current easy-to-implement linear algorithm? If no, please point out that other algorithm. If yes, are there any other easier to follow reference implementations?
I have a question that asks me to show that the PDA of the language L is not deterministic, but that the language is nevertheless deterministic. I was under the assumption that any deterministic language contains a PDA that is deterministic. The language in question is: $L = \{w \in \{a,b\}^* : n_a(w) = n_b(w)\}$
What is the consequence of factoring and discrete log being in $P/poly$?
What scenarios would cause coroutines to be a better (i.e. more robust, easier to modify) answer than simple mutable objects? For example, in Fluent Python, the following running average example is used to show what coroutines can do: def averager(): total = 0.0 count = 0 average = None while True: ...
I have a bipartite graph $G = (U,V,E)$, where $U$ and $V$ are disjoint node sets and $U \cup V$ is the set of all vertices, and $E$ is the set of all edges. I'm looking for subsets $U' \subseteq U$ and $V' \subseteq V$ such that there exists an edge $\{i,j\} \in E$ for all $i \in U', j \in V'$ and $|U'| + |V'|$ is max...
I'm looking for a tree data structure that allows to keep the tree balanced in high (minimum high as possible). I mean, suppose a tree where: each node has a parameter k that is the maximum number of sons that can be attached to him, $0≤k≤N$ all the operations will be about insert and delete (no search): it's just jus...
I am currently writing a paper about automated theorem proving in first-order logic. Equality is not uncommon for mathematical problems and almost every theorem prover like VAMPIRE or SPASS has a calculus for equality. But the most paper are always writing about the term "superposition" calculus. A simple google search...
given RC = {x : C(x) ≥ |x|} is a set of Kolmogorov-random strings. How can I show that RC is co-re I have been reading this paper What Can be Efficiently Reduced to the Kolmogorov-Random Strings? which just says that we know that by Kum96 we know that RC is Co-re I was not able to find the proof of how that is prov...
If something is simple, then it should be completely explainable with a few words. This can be done for the λ-calculus: The λ-calculus is a syntactical grammar (basically, a structure) with a reduction rule (which means a search/replace procedure is repeatedly applied to every occurrence of a specific pattern until...
Huffman and Hu-Tucker codes are well-known compression schemes, which both come close to the entropy lower bound. It is known that if $L_1$ and $L_2$ are the lengths of a Huffman resp. Hu-Tucker code, then $H\le L_1 \le H+1$ and $H\le L_2< H+2$, where $H$ is the (base-2 Shannon) entropy of the symbol distribution. Is a...
I was reading "Doug McIlroy: McCarthy Presents Lisp" and the phrase "symbolic differentiation of univariate expressions" triggered a faint memory of a demonstration of differentiation done in haskell using higher order functions. (I think my memory is of using the language to produce a function that is the differentia...
I am basically trying to solve the following question: Given a set $P = \{\{1\},\{2\},\dots,\{n\}\}$ of $n$ sets of elements, our aim is to merge these elements into one set. At each step, sets can be only merged pairwise. How many different ways can this merge happen? For instance, given $P = \{\{a\},\{b\},\{c\},\{d\}...
Show that each of these languages is decidable for regular grammars by presenting a clear algorithm for each. In each case, assume is the encoding of a regular grammar as a string and L(G) is the language generated by G. a. ERegular = { | L(G) = ∅ } b. InfiniteRegular = { | L(G) is infinite } c. EQRegular = { | L(G...
Obviously, the brute force method of: DeleteRange(root, low, high) for n = low to high if n == root.key // key found return DeleteNode(root) // O(lg n) to delete elseif n < root.key // in left sub-tree root.left = DeleteRange(root.left, n, high) // recur into left sub-tree ...
Can I use recursion to find out the possible parenthesis we can add to this expression: 2*3-4*5 ? (2*(3-(4*5))) = -34 ((2*3)-(4*5)) = -14 ((2*(3-4))*5) = -10 (2*((3-4)*5)) = -10 (((2*3)-4)*5) = 10 I am not able to find out the right states for the recursion to proceed. As at any point we wouldn't know if it would have ...
I understand how the divide part of the algorithm works and how it is meant to spread efforts. What I don't understand is how would you merge blocks [7][14] and [3][12] or [9][11] and [2][6]. For the latter part it's easy enough as you just concatenate them ( although how do you know that? ) but for [7][14] and [3][1...
So I have an array $A$, already sorted with CountingSort. Now I reduce one randomly chosen element $j$ with $A[j]>0$ by $x \in \{1 \dots A[j]\}$. I still have the counting array $C$, since I have sorted the array with counting sort. The question is: how can I now sort the modified array in $O(k)$? So far: Obviously I ...
Given an graph $G$ and two, randomly chosen, non-adjacent nodes, let's call them $s$ and $t$, we make the following two notations: $P_L(s,t;G)$ = the maximum number of internally disjoint paths (paths that don't have any node in common, except s and t) with a length at most $L$ (L ranges from 1 to |G|). $K_L(s,t;G)$ = ...
Suppose a pair of random variables $(X,Y)\in\mathcal{X}\times \mathcal{Y}$ with joint distribution $P_{XY}$ is given. I am interested in a deterministic mapping $f:\mathcal{Y}\to \{0, 1\}^k,$ for some integer $k>0$ such that $$f(Y)\perp X, \qquad \text{i.e.}, \quad f(Y)\text{ is independent of } X,$$ and $$H(f(Y))>0...
In my book it is written: $$[[\text{while b do S}]] = \text{FIX F}$$, where $Fg = cond (\beta[[b]], g\circ [[S]], id). $ What is cond ? $[[\text{if b then S1 else S2}]] = cond (\beta[[b]], [[S1]], [[S2]])$. I don't understand why we should use $FIX$. What it is FIX ? For me it is sufficient: $S[[\text{while b do S}]...
Here is a recent homework problem of mine: Call graphs G and H isomorphic if the nodes of G may be reordered so that it is identical to H. Let ISO = {⟨G,H⟩| G and H are isomorphic graphs}. Show that ISO ∈ NP. In order to solve this problem, I created a non-deterministic Turing machine that did the following: Che...
If you want to make good predictions with machine learning (supervised learning in particular), you need a good training set. And relevant predictors in your feature set can be overshadowed by irrelevant training data. Validation can help you to figure out what training data is good - you can then remove irrelevant inp...
There's a famous theorem that every infinite Turing-recognizable language has an infinite decidable subset. The standard proof of this result works by constructing an enumerator for the Turing-recognizable language, then including the first enumerated string in the decidable language, then the first string that comes a...
$B=\{\left<M_1,M_2,...,M_k\right>\text{ : Each $M_i$ is a DFA and all of the $M_i$ accept some common string.} \}$ I'm trying to show that B is NP-complete. I know I have to reduce it to another NP-complete problem, but I'm having a lot of trouble coming up with the algorithm that decides B. I was thinking I could kee...
What does the following mean exactly for the potential method? Is this applicable to all situations? If the potential is positive, then we overcharged for some operations. If it is negative, we are undercharged.
$L = \left \{ \epsilon \right \}$ Clearly this language is finite so this must be a regular language. Now since every regular language is Context Sensitive, $L$ is a CSL. We can define the grammar for $L$ as : $S\rightarrow \epsilon$ Now since $L$ is a CSL, this grammar must be a Context Sensitive Grammar. But from th...
I'm studying Bayesian networks and want to clarify a couple of things with people who are more knowledgable in the area than me. As far as I understand it, a Bayesian network (BN) is a directed acyclic graph (DAG) that encodes conditional dependencies between random variables. The graph is drawn in such a way that the ...
If $L_1$$\subseteq$ $\Sigma^*$, $L_2$$\subseteq$ $\Sigma^*$ , $L_1$ is regular and $L_1$$\cup$ $L_2$ = $\Sigma^*$ then is $L_2$ necessarily regular? I think that the answer is yes, but I'm not sure on my proof. The reason that I think that $L_2$ is regular is because surely $L_2$ just accepts all the words in the langu...
Speaking about multiagent systems (MAS) is about as fuzzy as talking about artificial intelligence systems (AI). They are in essence the distributed counterpart of AI. While there are no so-called "AI theorem", AI research had given rise to many subfields, algorithms and scores of theorems (e.g. game solving, fuzzy log...
A yes answer to an NP problem must be deterministically verifiable in polynomial time. The complement is that the no answer must be similarly verifiable. If the problem is NP-complete, there will generally be an intractable number of possibilities. How can it be possible to deterministically verify the no answer for a...
I was reading about deadlocks in Operating Systems. Where I came across two examples below. Circles with label $P_x$ are processes. Squares with label $R_x$ are resources. Each dot in the square represents single instance of resource type $R_x$. An edge from $R_x$ to $P_x$ means an instance of resource $R_x$ is alloc...
Here is a note about online set cover problem: we are initially given the $m$ sets, but we do not know which elements they contain. At any time $t$, we get a new element $e_t$ and learn which sets contain $e_t$. We then have to irrevocably pick a set that will cover $e_t$ if it is not already covered. The goal is agai...
Okay so I was reading about the Patriot Missile Software Bug, where to calculate the predicted range gate the missile system relied on the time keeping, however it would convert the whole/integer time number it stored (say 3600000) to 24 bit multiplying it by 1/10 (0.00011001100110011001100) to produce the time in real...
Suppose we have a graph $G=(V,E)$ connected and $K_{1,3}$-free. Sumner proved that every claw-free connected graph with an even number of vertices has a perfect matching (so, it is maximum matching). Describe an algorithm to construct one matching of cardinality $|V|/2$ in $G$ in time compelxity $O(|V|+|E|)$. I thought...
I came across the following example that proves that the blank tape halting problem is not decidable. I understand the proof technique, but I just don't see how the blank tape problem is shown to be undecidable in the proof. It says $M_{w}$ starts with a blank tape but then writes $w$ onto the tape, so there is no dif...
In Ladner's theorem, can we take $\mathsf{NPI}$ problems to be problems in $\mathsf{SUBEXP}\cap\mathsf{NP}$? Is this a proper subset? Can we extend Ladner's theorem to interpret $\mathsf{SUBEXP/poly}\cap\mathsf{NP/poly}\neq\emptyset$ hold? Does proper extension of Ladner's theorem indicate an analogous proper subset in...
I'm struggling with a problem in my theory of computation course that asks us to prove "QUESTION" is NP-complete by reduction from n-variable 3SAT. I've done a number of other similar reductions but I keep getting stumped on this particular problem. We define a question as a string over the alphabet $\{0,1, ?\}$ and sa...
Consider a complete bidirectional weighted graph. Weight of each edge (a,b) is the probability of getting from a to b. So all weights are in range (0,1]. Probability of going from a to b through the pass a-c-b is w(a,c)*w(c,b). So if I want to find the probability of getting to all the other nodes from a can I use mult...
Does every pure function have a branchless equivalent? By pure function I understand a function that uses only its input values and no global state to produce the output. By branchless function I understand a function that does not use if/else during its execution. A loop contains a branch with and unconditional jump. ...
I was going through the Ford-Fulkerson(FF) algorithm. The given graph is directed and there is an edge from A to B with capacity y. Now sending a flow of x units (x < y) from A to B is equivalent to sending -x units from B to A, so we add a back edge from B to A of capacity x units. And the FF algorithm can send a flow...
Consider a $10^7$ bps link that is $400$ km long, with a queue large enough to hold $2000$ packets.Assume that the packets arrive at the queue with an average rate of $4000$ packets per second and that the average packet length is $2000$ bits.Find the average number of packets in the queue. I am getting Avera...
Let $s$ and $t$ be 2 vertices (not adjacent) in graph $G$. Let $p_l(s,t;G)$ be the $maximum$ number of vertex-independent paths from $s$ to $t$ in graph $G$, of length $\le$ $l$ ($l \in \{1,...,|G|\}$). Also, let $k_l(s,t;G)$ be the $minimum$ cardinal of a set of vertices (different from $s$ and $t$), that if we remov...
I came across the following theorem in Sipser's about incompressible strings. Let $\;f$ be some computable function which holds for almost all strings. The for any $b > 0 $, the property $\;f$ is false only on finitely many strings that are incompressible by $b\;$. where "almost all strings" means that as $n$ grows t...
In this question, we see how to model boolean logic in $0 - 1$ ILPs. Moving to a relaxation, modelling $(x > 0 \vee y > 0) \Leftrightarrow z > 0$ with $x,y,z \in [0,1]$ with linear constraints is quite simple: $$z \geq x\\ z \geq y\\ x+y \geq z$$ However, if I want to replace $\vee$ with $\wedge$ in that statement, I'm...
I know this question is a bit redundant but I am trying to understand a subtle difference between Dijkstra Algorithm and Floyd-Warshall Algorithm. Can I say running Floyd-Warshall is equivalent to running Dijkstra on every vertex in the graph? In other word, Dijkstra will output the optimal path from a single source to...
I was reading Structure and Interpretation of Computer Programs (SICP), MIT. What I have understood is that in pure functional programming language, there is no such thing as a local state. SICP, pg 230 says: "Programming without any use of assignments, as we did throughout the last two chapters of this book, is accord...
The other day someone mentioned to me that you could take an arbitrary digital circuit which mapped N input bits to M output bits, and replace it with a layer of OR gates and a layer of AND gates. I believe he said there would be 2^N ANDs and ORs each. I haven't been able to find any more information about this thoug...
Carla. D. Savage formulated the following approximation algorithm for the vertex cover problem. Given graph $G$, start at arbitrary node and traverse $G$ depth-first Obtain DFS tree $T$ return $V_C =$ internal nodes of $T$. Now I read everywhere that this algorithm is supposed to yield a 2-approximation, but the only...
Consider the following problem: Given positive integers $a_1,\ldots,a_n,b_1,\ldots,b_n,A,B$, does there exist a subset $S$ of $\{1,\ldots,n\}$ such that $\sum_{i\in S}a_i\geq A$ and $\sum_{i \in S}b_i\leq B$? Is this problem NP-hard? I'm thinking there is possibly a reduction from the subset-sum problem, but here there...
Define an NFA with 4 states that is equivalant to the following Regular Expression. $(01 + 011 + 0111)^*$. My main problem is that to check for a string of length 4 (0111) I need at least 5 states to begin with. So to my (novice) little brain the question seems wrong.
Assume there is a set {1,...,n} of person. For each person i, a set $A_i$ of items are available for exchange. A is the set of all items. The value of item j to person i is $v_{ij}$ and assume all values are positive integers. The question is, does there exist a pair of person who can both make profit by exchanging som...
I came across this on Art of Computer Programming long time ago Computer manufacturers of the 1960s estimated that more than 25 percent of the running time on their computers was spent on sorting, when all their customers were taken into account. Is there any recent study about the estimated percentage that co...
I have the following points, shapes, and paths. I would like to find a path that goes through all of them: I want a path that first traverses the circle, then traverses the square, then traverses the star in the middle, in that order. It's simple to go to the circle from the bottom left and around it, hitting each po...
I have implemented in C++ the Needleman-Wunsch algorithm for pairwise sequence alignment using the following scores: +1 for match (regardless of base) -1 gap penalty -1 for a mismatch. Given two sequences of length $m$ and $n$ the algorithm then generates the $mn$ search space row by row as per the algorithm's specif...
I am studying the algorithm of Sollin and we recently studied a lemma: Let be G a graph which values are diffferent on the edges. We sort the edges $e_1,e_2,...e_m$ such as $v(e_i)<v(e_j)$ Every tree of minimal value has at least $e_1$ et $e_2$ Proof let be A a spanning tree which doesn't have $e_1$ $A\bigcup\{e_1\...
Theorem: Let be $G$ a weighted graph in which every edge has a different weight. Suppose that $G$ has two spanning trees $A$ and $A'$. Let be $i$ the first index such that $e_i\ne e'_i$ and $i\ge 3$. Suppose that $w(e_i)<w(e'_i)$ and consider that $A' \cup \{e_i\}$ has a unique cycle. For each edge of this cycle the...
Hopefully this question makes sense. Basically, given a DAG, a set of nodes A, and another node b, I'd like to know if node b is an ancestor of any of the nodes in A in that graph. This is my current implementation: def is_ancestor(graph, A, b): nodes_visited = set() frontier = list(A) while frontier: ...
Considering a network of $n$ IT centers $1,...,n$ we can connect by lines which heve different characteristics. Among these charateristics, we take an interrest in the reliability of a line. Thus, let be the error rate $p_{ij}$ which represents the probability for a message channeled by a line tio be corrupted. We adm...
We all know Random Access Machine (RAM) models are programmable machines. We can program a same machine for different problems with the help available instruction set. But in the case of Turing machines,we give full description of TM including transition table (which is equivalent to stored program in RAM model). So sh...
A long time ago I read a newspaper article where a professor of some sort said that in the future we will be able to compress data to just two bits (or something like that). This is of course not correct (and it could be that my memory of what he exactly stated is not correct). Understandably it would not be practical ...
To give some perspective, first consider the following diagram comparing Markov Chains, HMMs, MDPs, and POMDPs (I'm not sure who to credit for it). Fully observable Partially observable _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ...
The Mersenne Twister is widely regarded as good. Heck, the CPython source says that it "is one of the most extensively tested generators in existence." But what does this mean? When asked to list properties of this generator, most of what I can offer is bad: It's massive and inflexible (eg. no seeking or multiple stre...
We're given a set of items $A=\{1,\dots,m\}$ and a set of people $B=\{1,\dots,n\}$. Each person has a preference ordering for the items in $A$. Each item in $A$ has a specific positive cost for each specific person in $B$: item $i$'s cost to person $j$ is $c_{ij}$. For any non-empty subset $T \subseteq A$ of items, w...
I know that a polynomial-time constant factor approximation algorithm for the general Traveling Salesman Problem does not exist unless P=NP. However, I want to prove that the TSP decision problem (is there a Hamiltonian cycle of graph with weight sum <= k?) is in P if we assume that there is an approximation algorithm ...
I just wonder where the ROB is in. Is ROB in the memory or cache or where??
I have found a algorithm to check whether a Hamiltonian Cycle Exists in the graph or not, but not able to compute/analyse it's time complexity. The algorithm is as follows : Label all the vertices with distinct prime numbers. Label all edges with weight equal to 1. Now remove one vertex at a time, while removing a ver...
I am trying to understand static vs dynamic typing, but am really struggling to see how everything fits together. It all starts with data types. As far as I understand, data types are quite abstract notions, which exist 'in' compilers in order to categorise data so that the operations on various types of data can be va...
This is a question involving regular expressions for regular languages. I am currently stuck trying to prove that the operand ∅ is not necessary unless the language is the empty set. That is, a regular expression is either equivalent to ∅ or is a ∅-free regular language. (A language is ∅ free if it contains no occurenc...
As much I know about a memory and storing data there would always be a managing type feature in every memory which manages all the data and its location. So, what is the file system of a RAM. I also like to know the format or type (mp3, pdf, png, txt, jpg or binary) of data stored in.
The isomorphic induced subgraph problem, is the problem of deciding whether, given two graphs $G$ and $H$, $G$ contains an induced subgraph isomorphic to $H$. Is there a proof using Courcelle's theorem, that this problem is fixed-parameter tractable when parameterized by $|H|$ and $\mathrm{tw}(G)$ (treewidth)?
when I write a program, in a Von Neumann architecture, how the ram will be divided to receive data and instructions? For example if I have 1 MB of ram, the addresses from 0 to 499.999 for data and from 500.000 to 999.999 for instructions? Or I could find instructions mixed with data? Is divided the entire memory for ex...
I am wondering why data fragmentation is a problem on main memory. On a software level, virtual addresses are used anyway. So why can one address space not be split up into multiple segments, like a hard disk might do? I don't see how the performance would be affected, as the time needed to access memory addresses does...
Let the input be an array of $n$ elements, with $k$ sets $S_1,...,S_k$ such that each set has $\frac n k$ elements. The elements in each $S_i$ are larger than the elements in $S_{i-1}$. Find an algorithm that sorts the input in $O(n\log (\frac n k ))$ runtime. Find a lower bound for the minimal amount of comparisons ...
Olin Shivers, ‘History of T’: Maclisp on the [PDP]-10 had used a mark&sweep GC (one version of which famously "ran in the register set," though that is another story) This implies, in my interpretation, that the garbage collector used no storage other than the registers of the machine. Is my understanding of this cor...
I had an exercise: Describe the language generated by the following given context free grammar and prove it by induction. $$\begin{align} S &\to SA \mid \epsilon \\ A &\to aS \mid bA \mid b \\ \end{align}$$ I got this wrong on my test and my professor isn't explaining why. Just references the pdf notes he gave...
I want to make this program below but I'm not sure how i would start them. Would i use methods with or without return? I have this due tomorrow and cannot figure it out. I've wrote the code multiple times but ended up deleteing it all. Part 1: Allow user to enter one character (L or S) and three integers betwee...
I'm trying to find out what strings this NFA would accept. From what I understand, an empty string would work, as well as any string that has nothing but 0's. But for strings containing 1's, I'm a little unsure. It would seem that as long as any 1 in the string has a 0 on either side of it (ex. 0100 or 01010), it would...
Give a finite state diagram for a DFA that accepts any word in the language $L = \{w \mid w \in \{a, b\}^* \text{ and }w \text{ alternates } a\text{'s and }b\text{’s and has an even number of }b\text{’s}\}$. My attempt: I am having problem on how to deal with the even part of b.
If $f:\mathbb{N}\rightarrow\mathbb{N}$ is computable and has an inverse, under what conditions is $f^{-1}$ also computable? I couldn't find that in a textbook, and googling gets some vague suggestions about bijective, but I couldn't find a clearly stated theorem to that effect. Offhand, bijective seems sufficient but n...
I know HAMPATH is NP complete problem. But is there a way to tell if it is either a NL or L problem? I tried searching a lot of places online but it feels like I am going nowhere. Thanks in advance for any leads
Is there an NP complete language having no polytime decidable superset (apart from the set of all strings)?
I show from Wikipedia that the optimal number of hash functions is: $k =\frac{m}{n}\ln{2}$. However it's not obvious for me why, even after reading the Wikipedia article (such as the one on false positives). Anyone interested in explaining with simple words? :)
I saw here: http://www.cs.cmu.edu/~ninamf/ML11/lect0906.pdf Intuitively, if “n” is large but most features are irrelevant (i.e. target is sparse but examples are dense), then Winnow is better because adding irrelevant features increases L2(X) but not L∞(X). On the other hand, if the target is dense and examples are spa...
How does one prove L(G)=L if the language is not given and only the grammar G is given? If there is no pattern to be seen in the grammar that would create the strings w of a language L, how would you go about doing this?
The Naive way to reduce space complexity of Floyd-Warshall algorithm is consider only $d_{ij}^{(k)}$ and $d_{ij}^{(k-1)}$ in each time. But in this case, we can't track actual shortest path with knowledge only two $d$ tables. It requires whole table. There is a nice solution: Johnson's algorithm reduce both time and sp...