instruction
stringlengths
35
11.4k
Let $A$ and $B$ be finite alphabets and let $\#$ be a symbol outside both $A$ and $B$. Let $f$ be a total function from $A^∗$ to $B^∗$. We say $f$ is computable if there exists a Turing machine $M$ which given an input $x ∈ A^∗$, always halts with $f(x)$ on its tape. Let $L_f$ denote the language $\{x\#f(x)∣x∈A^*\}$. ...
I am interested in such a combinatorial problem: given a graph $G=(V, E)$ and a weight functions $w_v: V \mapsto R$, and $w_e: E \mapsto R$ we are asking about such a induced subgraph $G' = (V', E')$ of $G$ that maximizes the sum: $ \sum_{e \in E'} w_e(e) + \sum_{v \in V'} w_v(v) $. The problem is NP-Hard (by the reduc...
I have a continuous state space MDP as a generative model. I input the state and action and it outputs the reward and the next state. Assume that I sampled $n$ state-reward-states. I wonder how I can implement value iteration using a function approximator. I couldn't find any implementation example online. Can you plea...
What are some simple algorithms that find the maximum of a function in a certain domain? The function $f$ is guaranteed to have 1 maximum and no other turning points between $a$ and $b$, how can I find out what the value of this maximum is without knowing anything about the function? I can only query what $f(x)$ is for...
I'm a bit confused about the concept of finite state automata (FSA) and regular expression (RE) in lexical analysis. I have reading some books about compiler construction. At the part of tokenization, all the books I read talk about the regular expression first to recognize the tokens. For example, the regex below is ...
I know the method to the find the minimum pumping length of regular language by constructing minimal DFA and finding the number of states but I am not able to quite understand why is it working. For example, $L = (10)^*$. Here minimum pumping length is 1 by constructing DFA. But by pumping lemma, how can there be a str...
What language is accepted by a Turing machine which has a state that it does not enter on input I? Specifically, 1.If the accept state is the state that it never enters then should L={empty}? 2.If the reject state is the state that it never enters then should L={everything}? 3.What if the TM has multiple accept/reject ...
How can I convert a clause of size 3 that is made of 2 OR gates example: (x1 OR x2 OR x3 ) to one or more clauses of size 4 made only of NAND gates and not gates? So without parentheses inside the clauses. examples: (x1 NAND x2 NAND x3 NAND x4) (not x1 NAND x2 NAND not x3 NAND not x4) AND (x1 ...
Among the Turing degrees are degrees of the form $0^n$, e.g. $0$, $0'$, $0''$, etc. I'll just prove this quick for completeness' sake. Hopefully nobody has any qualms with this short proof: Lemma: Any countable set of sets of natural numbers can be encoded as a single set of natural numbers, such that each original s...
I'm tracing through a quick sort algorithm on paper, but I keep getting stuck on the partitioning using Hoare's partitioning. The array is {3,1,4,1,5,9,2,6,5,3,5}. I'm using median of three for the pivot, so pivot is 5, I swap the pivot with the left and have {5,1,4,1,5,9,2,6,5,3,3}. I go through the algorithm as fo...
As we know, dependent type allows programmers to write bugless programs. But as I know there's only very few languages support dependent type, like Haskell with extensions, Idris, Agda, F*, etc. Since these are all functional languages, is there any possibility to add dependent type into an imperative language? I've go...
We have a network of sensors organized in tree form, where the sensors occupy the nodes. Most of the time the sensors are turned off, until the root sensor wakes up the rest of the sensors. This process of awakening the nodes requires a certain amount of time since, in a unit of time, a sensor can awaken only ...
In the textbook by Arora-Barak, they define PCP verifier as While in the definition they put a restriction of $q2^r$on the length of the proof, later, they say that it is inconsequential as the machine can look on at most this number of locations with nonzero probability over all $2^r$ choices for its random string.
Am learning the concept of Coding Redundancy in image compression and am finding it hard to understand the table on page 3 of this document. All other explanations seem to follow the same symbols and methodology but don't explain the concept clearly. Question1: In the first column, r1=1/7, r2=2/7 etc and r7 is 1. Why...
Given a trapezoidal map of a simple polygon $P$, is it possible to compute the triangulation of $P$ in $\mathcal{O}(n)$ time?
I'm trying to address what I perceive to be a potential shortcoming in the Elo Rating System (predominantly used by the international Chess community to rate + rank players). I have a two-player game in mind (not Chess) that is played all over the world, and I'd like to start rating/ranking its players using Elo, but a...
While studying Coq, I found a few references that impredicative Set might not work well with classical axioms, in particular the axiom of choice. I'm working on a dependent type system based on the calculus of constructions (with Prop and Set), on which I intend to add Peirce's law on sets, as in the computability side...
I understand that vulnerable time is the time when collision is possible. In CSMA/CD, the vulnerable time is Tp because it takes Tp time for bit to travel from source to destination and collision might occur during that time.Here Tp is propagation delay. Even in pure aloha, I understand how is vulnerable time 2*Tt time...
If I want to solve a game of nim with 3 piles containing (x, 2x, 3x) respectively I know that the solution of (winning) iff x^2x^3x != 0 but if x can be in the range from 1 to 2^61 so How many winning states in this range? I want to solve this problem ... I tried to find a pattern but I think there is no pattern for t...
We are given $N$ sets of $M$ non-unique elements each. The amount of overlap (computed as the element count in the set intersection) between the elements of these sets is stored in a $N \times N$ matrix. The aim is to find a way of grouping the $N$ sets into two classes, where one class has roughly 67% of the sets and ...
What conditions must be fulfilled for two edges of a graph to be called adjacent? I found a lot about adjacent nodes, but our CS course script refers to adjacent edges, with no explanation.
$L_1=\{ ⟨M⟩ ∣M$ takes at least 2016 steps on some input$\}$ the answer says $L_1$ is recursive. I am stuck at one point and i am wasting my time on it here for $L_1$ if we are given a set of to see if it takes at least 2016 steps I can use dovetailing idea and say yes for some inputs here string length doesn't matter ...
First of all, let me define $Dioph(M)$, where $M$ is a set of numbers: $$Dioph({M})=\{p \mid \text{ $p$ is a polynomial with integer coefficients and the zeros of $p$ are in ${M}$}\}.$$ Let $p \in Dioph({Z})$ and $q\in Dioph({N})$. I am trying to find a (computable) reduction $f$ from $Dioph(Z)$ to $Dioph(N)$. My i...
Im learning Haskell and i want to prove take m (drop n xs) = drop n (take (m+n) xs) and drop m (drop n xs) = drop (m+n) xs Somebody can help me please? :)
Is there a way of combining two turing machines without introducing an extra state (I don't want to increase or decrease the total number of states)? Don't worry about an accept or a reject state since they are not that important; I just want a TM to do some computation starting from a blank tape, and I want the result...
I want to know what will be the time complexity to search, insert and delete an element in a) balanced binary search tree. b) unbalanced binary search tree.
Let $G$ be a directed, acyclic graph of order $n$, such that: $G$ has exactly one source vertex $s$; $G$ has exactly two sink vertices $t_1, t_2$; The out-degree of any non-sink vertex in $G$ is exactly 2; and The longest path from $s$ to either of $t_1,t_2$ has length $k$. What is the most efficient way of finding a...
I'm interested in the complexity of a particular variant of 1-in-3 SAT. Assume, as is usual, that clauses are allowed to be of length 1, 2, or 3. Then add the restriction that for any clause of length 3, at least one variable must be "unique," meaning it must appear in no other clause. Another way to phrase this is, fo...
The following comes from Patterson & Hennessy Computer Org. and Design (5th ed., p. 390): How many total bits are required for a direct-mapped cache with 16 KiB of data and 4-word blocks, assuming a 32-bit address? My question is, how can we determine the tag bits based on the book's answer? The answer shows the f...
I need a tree structure that works roughly like the following for each new child I need to match it (with some criteria) with a parent from the previous level only when the tree is completely initialized, for each leaf I need to find the first parent ancestor that has siblings, i.e. the node just after the branching p...
I've learnt during graph algorithms studies that if a treewidth of a graph is greater than k+1 then there's no feedback vertex set of size k in this graph. I would like to understand why...I mean, I understand that if it's enough to remove k vertices to make the grapy acyclic, so there must be a tree composition whose ...
Problem Let's say we are given a program and we want to find an algorithm that analyses its asymptotic complexity. This program can only have two types of statements: do_something and the for loop. The for loop is defined as followed. for <variable> = <from> .. <to> <body> The for loop makes the <variable> itera...
I am currently looking for a way in which I can store my data, and quickly look it up. What currently seem to be the best idea is to use a hash map. reasons: To identify what item I am looking for, one need to extract a certain set of features from the data, which can be used as a key to extract the item. Problem he...
I was reading about complexity theory and I got a term Geometric complexity theory. I google the term on internet and find out that Geometric complexity theory (GCT), is a research program in computational complexity theory proposed by Ketan Mulmuley and Milind Sohoni. The goal of the program is to answer the most fa...
My book says lexical analysis detects reserved words. How can lexical analysis detect whether we are using reserved words in incorrect places ? For eg :- while(a>0) and int while = 5. How can lexical anaylsis differentiate the usage of while in both the above examples based on the context?
I have a nested function as follow: def make_adder(n): def add(x): return x + n return add >>> plus_3 = make_adder(3) >>> plus_5 = make_adder(5) >>> plus_3(4) 7 >>> plus_5(4) 9 What's the formal names of make_adder and add? Can I call them 'outer function' and 'inner function'?
In Vazrani's textbook, page 22, the following exercise: 2.1 Given a n undirected graph G=(V,E), the cardinality maximum cut problem asks for a partition of V into sets S and G\S so that the number of edges running between these sets is maximized. Consider the following greedy algorithm for this problem. Here $v_1$ and...
In Strassen's matrix multiplication, we state one strange ( at least to me) fact that matrix multiplication of two 2 x 2 takes 7 multiplication. Question : How to prove that it is impossible to multiply two 2 x 2 matrices in 6 multiplications? Please note that matrices are over integers.
I have two arrays, namely $a$ and $b$. Both have the same length $n$. I have to find the maximum value of $\sum a_i b_j$, in which every element can be used at most one time. My algorithm for solving this problem is: Sort both $a$ and $b$ in non increasing order. Pick the values from the array in order of greatest to ...
I have a point $q$, a ray $L$ (halfline which is cast from $q$) and two non-intersecting (intersection is only possible at endpoints) line segments $s_1, s_2$. I want to efficiently compute which of the two line segments along the ray $L$ is visible ("comes first"). I found the following description of a possible solu...
The DPDA definition is from sipser's book, and it mentions that the following PDA can convert to DPDA. I tried it, then I confused the definition! By definition, I could construct these $\delta(q_1,\epsilon,\epsilon)=(q_2,\$) $ and because of "exactly one of the values" $\delta(q_1,0 ,0 \text{ or } \$ \text{ or } \e...
Given that $T(n) = n^2 + bn + d$ then it's $O(n^2)$ if I can prove that: $O(n^2) = \{T(n): \text{there exist positive constants } c, n_0 \text{ such that } \forall n \geq n_0, 0 \leq T(n) \leq cn^2 \}$ So I was going to try and prove this using induction where $Let:\ c = 2bd, n_0 = 2$ $\text{Base Case} (n = n_0):$ $$n^...
For example, I have a program generates two ASTs, and I want to compare the two trees. I've tried to treat the trees as graphs, but I think it doesn't show the particularity of trees.
In SAT Modulo Theories (SMT), with the theory of uninterpreted functions, all functions are first order, that is, they don't take functions as arguments or return functions. In the theory of arrays, however, functions can take arrays as arguments, and return arrays as values. However, my understanding is that arrays in...
I am reading article about Applicative Abstract Categorial Grammars http://okmij.org/ftp/gengo/applicative-symantics/AACG.pdf and this article uses brackets [[...]] for action on terms inside applicative functors. These brackets are introduced and somehow explained in "Functional Pearl: Applicative programming with eff...
Given the language $$L = \big\{ 0^{m} 1 0^{2m+k} \mid m \text{ prime and } k \ge 1 \big\} $$ show that $L$ is not context free by giving a counterexample of the context free pumping lemma. It may be userful the pumping lemma of the language of prime numbers, you can find it here. A counterexample must be a string $z \i...
According to the Wikipedia page on Descriptive complexity theory: In the presence of linear order, first-order logic with a least fixed point operator gives P, the problems solvable in deterministic polynomial time. Existential second-order logic yields NP, as mentioned above. If P = NP, wouldn't it be possible to co...
I am trying to solve the following problem, which is a simplification of our original question: $\max\limits_{x,y}\min \{x_iy_i-b_i \mbox{ for } i=1,\ldots, n: x,y\in \Delta_n\}$ where $\Delta_n$ is n-dimensional unit simplex and $b_i$'s are arbitrary nonnegative numbers. $x_i,y_i$ is the $i^\mbox{th}$ entry of $x,y$ r...
I have a bunch of coloured bricks. There are X different colours, and a random number of each colour. How do I stack them up into Y columns so that a) no row has two bricks of the same colour and b) the height of the largest column is minimised? There is an obvious lower bound of highest number of bricks of a single co...
My Introduction to Computation Theory professor talked about how we can write more general grammars (called unrestricted grammars) for languages that are not context-free. For example, the language: $\{0^{2^n} : n\geq0\}$ is not context-free, so it cannot be generated by a context-free grammar. I am wondering if the la...
What kind of algorithm can have $O(1/n)$ complexity, where $n$ is a natural number? Or, is there any algorithm that the time it takes decreases when the data input increases?
Most hard problems can either be solved efficiently in average time, or an approximation can be efficiently found. Are there any natural problems for which this is not the case? In particular, is there a natural problem that can not be solved in polynomial time in the average case, even if we only demand an approximati...
I am trying to understand the proposed "Randomized Linear-Time Algorithm to Find MST". My findings: I have read and search almost every available resource( main paper, wiki, reports on paper, lecture on paper ) but not getting any clue regarding my confusion. Question: In the original paper Section 3: The Algorithm "S...
What is an example of an infinite decidable language $L$, such that $L \subseteq \overline { A_{TM}}$ (which is known to be not Turing Recognizable)? And of coures some evidence that L is indeed decidable and a subet as required
A list of pairs is given using Python. I want to remove duplicate occurrences of the first element of the pair leaving only one occurrence of each first element paired with the highest second element it comes with. I am looking for an efficient solution that returns the pairs sorted. >>> myfunc([[2, 0], [3, 0], [4, 0],...
It is commonly told that, while we write a program, we input with our language (A, B, C, D etc), whom computer translates into machine language into machine language made up of Zero (0) or switch off and One (1) or switch on, a.k.a. ASCII code. Letter ... ASCII Code .... Binary A ........... 065 ............ 0100...
I have to prove that the coding $\pi_k$ is effective given that $\pi_k$ is a surjective coding of $\mathbf N^k$ and $\pi_k$ is a recursive function. What I've got: A coding by definition is an injective function from a set $X$ to $\mathbf N$. I know by definition that a coding $\pi_k$ is effective if it is recursive a...
Let's say you are using a personal computer for 10 years. Assuming all software things are the same, will the computer get the same scores on benchmarks as 10 years ago? If not, why?
I would like to have a proof of the NP-completeness for 15-Partition Problem. It is analogous to the well-known 3-Partition Problem. The problem is to decide whether a given multiset of integers can be partitioned into subsets of 15 members that all have the same sum. More precisely, given a multiset S of n = 15 m posi...
Can Register renaming eliminate all WAR hazards? What I think is register renaming is not always successful because If CPU have limited number of registers and our programme is enormously large then required registers for renaming are much larger and register renaming will fail here.
Please help me! I've been asked to make a circuit using only Logic Gates to implement an 8-bit 2's complement subtractor. I was thinking of somehow modifying an 8-bit adder, but I figured it isn't 2's complement so it won't be of much use to me. Any help is greatly appreciated, even if it's a pointer to the right appr...
Koning's theorem states that the cardinality of the maximum matching in a bipartite graph is equal to the size of its minimum vertex cover. Wikipedia states that there is an equivalent version of the theorem for weighted graphs as well. I tried searching in a lot of places but could not find this theorem. To be more sp...
Given is the regular grammar G = ({A,B}, {a,b}, P, A) with the rules P : A → aB, a, ε (where ε is the empty word) B → bA, b For this regular grammar, create an equivalent NFA. A regular grammar is a 4 tuple G = (N, Σ, P, S). So our NFA is made up of 2 states, A and B. The initial state is A and it's also the end...
How can we generate 3 or more binary Sources using BSC channel. As we know, BSC can be easily used to generate 2 binary sources with some cross-over-probability(say p). Eg, length of codeword(say n) n = 1000; p = 0.2, then input and output binary codeword will be having Hamming distance of approx 200. In this way we ge...
I’m trying to prove that the following problem has an integer optimal solution. This will hold if the corresponding linear program would have totally unimodular constraint matrix. We have $m$ pieces of contiguous land parcels $\{1,...,m\}$ and $n$ agents with a simple valuation function that assigns $0$ to all the subs...
Let's assume there is something happen in the world - Football world cup final. And team-1 beat team-2 with the score 3:2. So there is whole bunch of articles on every website about it, each contains slightly different wording, sometimes even on different language, but they all about the same event, and contains mostly...
I am trying to understand Y combinators. Could you please explain why the following are equivalent (Y (f ∘ g)) (f (Y (g ∘ f))) (Y is a fixed point combination)
Quick sort algorithm can be divided into following steps Identify pivot. Partition the linked list based on pivot. Divide the linked list recursively into 2 parts. Now, if I always choose last element as pivot, then identifying the pivot element (1st step) takes $\mathcal O(n)$ time. After identifying the pivot eleme...
Find any kind of grammar for the language L = {w ∈ Σ* | in w there are twice as many a's than b's} and reason its correctness. Where w means word and Σ means alphabet, in this case obviously made up of a,b. So I imagine I can build a NFA for the language and then "transform" that NFA into a regular grammar. A NFA f...
If I have two Turing machines A and B, and I want to use an output of A as an input to B, how is it going to work? Can I just run A, keep the input tape, and then run B (without affecting the number of states A and B? Or do I have to combine an halting state of machine and an initial state of the other machine?
Consider the following operation on language $L$: $\mathrm{inv}(L) = \{ xy^Rz \mid x,y,z\in \Sigma^*, xyz\in L \}$ I understand that if $L$ is regular, then $\mathrm{inv}(L)$ is regular too, and proved it by guesing when $y^R$ starts and running it on the inverse DFA. However, if $L$ is a CFL, then $\mathrm{inv}(L)$ is...
I've a large list A of elements. Given another list B of elements, I need B to be sorted by the number of occurences in A (that is, least common to most common in A). A precise count of A would require too much extra memory/disk and an approximate count if sufficient for my needs. I couldn't find a common solution for ...
I currently maintain a score of around 400 problems solved at Project Euler. It may be great or not so great, depending on whom you ask, but I believe it's safe to say I'm not a newb at CS and coding - and I never brute-force and always follow the under-one-minute-runtime rule! And yet every time I solve one there and ...
A juice machine has three buttons small, medium large. Each size adds an amount of juice in a range to the cup. Eg small might add from 10-20 mL, medium from 30-35 mL, large from 40-50 mL. The exact numbers are relatively small (0-1000), integral, and known ahead of time Input: cup size (mL), amount to fill (mL) Output...
So I have this programming prompt which asks me to figure out how many permutations of a 32 coin toss sequence do not have three or more heads consecutively tossed. We are supposed to use Dynamic Programming to do this and I'm having a hell of a time identifying the recursive algorithm for this. My first thought was a ...
Consider the alphabet $Σ = \{1, +, =\}$ and the following language, $PLUS = \{ 1^m + 1^n = 1^{m+n} \mid m, n ∈ ℕ \}$. Prove with Myhill-Nerode that PLUS is not a regular language. I know how I should use Myhill-Nerode here and how I should show that any two strings in the infinite set $S$ are distinguishable, but I ...
Find the flaw in the following proof that P != NP: "We are going to show that P != NP using the following steps: Describe a problem. Show that said problem is a NP problem. Prove that the lower bound for any algorithm that solves the problem is exponential using an adversarial argument (similarly to showing lower bou...
Note: This is almost certainly an elementary problem with a well known solution. Therefore pointers to existing references will be accepted as good answers. Question: Given a cycle with exactly $n$ vertices, how many distinct chords are possible? This question is motivated by the definition of chordal graph, which on...
A problem may require memory space which is not polynomial with respect to the input size but may still have polynomial run time. Is this true or false? and why? any idea?
If two minimum spanning trees on the same graph only have 2 edges in common, then those two edges must be the lowest costs edges in the graph. True/false? and why? Because according to me if there is a only edge which connects 2 subgraphs then that will be included in the MST whatever might be the value. So according...
I've been stumped on this question for a while and can't find a solution. How can I find the max 3 colorability of a graph(optimization problem) with 3 colorability (decision problem) without brute force searching every combinations of edges?
Is the stable matching problem greedy or Dynamic ? Please anyone can give a strong explanation as i tried to find it on the net but it isn't available.
I know that for standard page tables each process would have its own page table and for inverted the OS would have it. But other than this what are the main differences between a standard page table and an inverted one?
What is the biggest number of components in a graph that has 14 vertices and 44 edges? Since total degree of all vertices in a graph equals to 2 * number of edges, I calculated that for 44 edges, 14 vertices together must have 88 degrees. 88 / 14 = 6, therefore each of them would have to be connected to other 6 vertice...
I need a good data structure to store the following data: The data are key,value pairs. However, more than one value maps to one key and the key is an n-tuple with n constant. Here's an example: key | values (k1, k2, k3, k4) | v1, v2, v3 (k5, k6, k7, k8) | v4, v5 A value is an object. The following ...
Imagine a turn-based game where two robots are placed on opposite sides of a 16x16 board, facing each-other. Each robot, at each turn, can perform one of 2 moves: move (moves forward), turn (turns 90 degree; clockwise for the first robot, anti-clockwise for the second). They can also send messages to each-other, and be...
Tried a bunch of resources to read about it, still don't really get it. This is what Wikipedia says A prefix code is a type of code system (typically a variable-length code) distinguished by its possession of the "prefix property", which requires that there is no whole code word in the system that is a prefix (initial...
We know $UP\subseteq NP\subseteq PP$. Is $UP^{\oplus P}\subseteq NP^{\oplus P}\subseteq PP^{\oplus P}$? I think the first $UP^{\oplus P}\subseteq NP^{\oplus P}$ is straightforward since whatever queries an $UP$ machine can do we know an $NP$ machine can do. How to show second $NP^{\oplus P}\subseteq PP^{\oplus P}$? ...
I have a question regarding Turing machines. Are these two tapes the same thing? First one = _ _ _ _ * A A A B B B Second one = * A A A B B B _ denotes a blank tape cell.
I'm working on the following problem: let $G = (V, E)$ be a connected, planar graph. Our goal is to find a $d$-partition of $G$, $P = \{V_1, \ldots, V_d\}$, such that $G[V_i]$ is connected, and $\min_{V_i \in P} |V_i|$ is maximized. (That is, the partitions are as balanced in size as possible.) This is the balanced con...
I have just started learning Automata Theory, so far I only know about regular languages, FSM (NFAs and DFAs) and regular grammars, but I come across a question like this: "Given the next languages, design their respective DFAs" $L := \{a^nb^m |\ n>m\ ∧ n-m = odd\}$ $L := \{a^nb^m |\ n>m\ ∧ n-m = even\}$ $L := \{a^kb^m...
I have the following problem: Given an array $A$, I need to construct an array $B$ such that $B[i]$ is the minimum $j>i$ such that $A[j]>A[i]$, or Null if no such $j$ exists. For example, if $A = [23,45,13,10,33]$ then $B = [2,Null,5,5,Null]$. The algorithm should run in time $\Theta(n)$.
I know that ETH states that 3-SAT is not solvable in $2^{o(n)}$ time, the best known bound for 3-SAT is around $O(2^{.38n})$. Whereas, SETH states that there is no universal $\delta$ such that for every positive integer $k$, a $k$-SAT problem is solvable in $O(2^{\delta n})$ time. It is not clear to me that how does SE...
Given: A list of $n$ integers $x_1,x_2,\dots,x_n$ and an integer $k$. Determine: Is $\sqrt x_1 + \sqrt x_2 \cdots \sqrt x_n \le k$? Question: Is there any polynomial time algorithm for the above problem? If yes, give an algorithm; otherwise prove it.
I am trying to prove they are not equivalent , a model which satisfies the fist one but not the second since I think EG EF p is stronger than E[GF p],any leads would be helpful. Thanks.
I created a context free grammar for the language which has words where twice as many a than b occur. So as example, the language would accept the words baaaab and bbbaaaaaa, aab, etc. The context free grammar is G = ({X} {a,b}, P, X) P: X -> XaXaXbX, XaXbXaX, XbXaXaX, epsilon (where epsilon is the empty word) Now how...
Given a context-free grammar G. Is it decidable, if the language $L(G)$, which is generated by G, contains a palindrome? My suggestion is, that it is undecidable, but I do not have an idea for a formal prove. Any hints?
Deciding if the infinite union of a set of regular languages is regular is undecidable. By closure property of regular languages, regular language is not closed under infinite union so is the above problem undecidable?
So I need to solve the knapsack problem, but I need to make sure that the end solution consists of an even number of items. I found this on an already existing question: You can keep two tables with $n$ rows and $C$ columns: $DP_{even}$ that saves the best knapsack solution with an even number of itens. $DP_{odd}$ th...
I have 2 types of points in a 2D plane, type 'A' and type 'B'. How do I delete the minimum possible number of points so that remaining can be separated (on different sides) by a straight line. I tried modeling this as a graph, where I have 2 types of nodes, and i delete nodes from it. But I can't formulate an algorithm...