instruction
stringlengths
35
29.1k
So basically, in my government class, we are simulating a presidential election. Our grade comes from the presentation of our candidate, but as an added challenge our teacher has a running count of electoral votes garnered. How it works is like this: there are only 18 states amounting to 286 delegates, so 144 needed ...
Given a directed conected graph which representation is its adjacency matrix $A$, design an algorithm to detect a sink in $\mathcal{O}(V)$ time, being $V$ the number of vertices. As definitions can vary, in this context, a sink is defined as a vertex with $0$ exit degree and $V-1$ enter degree. Obviously, the problem...
It seems correct that any single given algorithm must either have polynomial runtime or not. Is there a specific algorithm that (does or does not actually lie in $P$, but) can neither be proven nor disproven to do so? Is there a decision procedure for "$\in P$"? Do we know $P$ vs. $NP$ to be decidable? Could it be pro...
We have a language $L \in PSPACE$. Is it possible to reduce it with $f \in LOGSPACE$ to $L'$ and $L' \in DSPACE(O(1))$? Why/why not?
An k-input LUT (look up table) takes in atmost k-inputs and gives 1 output (which is a function of the k inputs). I need to devise an algorithm to find the minimum number of k-input LUT's required to express a n variable boolean function. For example : - n=8 and k=4 8 input variables are a0,a1...a7 1) f1(a0,a1,..a7)= a...
I have defined an Inductive in Coq for binary representation of natural numbers as follows: Inductive bin : Type := | Z : bin | T : bin -> bin | M : bin -> bin. and two recursive functions to convert between nat and bin types as: Fixpoint nat_to_bin (n : nat) : bin := match n with | O => Z | S n' => in...
It is an open question that whether $\mathsf{DFS\text{}}$ can be done in $O(m+n)$ time and $O(n)$ bits of space, where $n,m$ represent the number of vertices and edges in a undirected graph. see this for DFS DFS for directed graph is known to be in RNC i.e. randomised NC. $\mathsf{DFS\text{}}$ also known to be $\mathsf...
In case 3 of the master theorem, which is applicable when most of the work is being done at the top node (roughly speaking), we also need a regularity condition that the work done at the topmost level is greater than that at the bottom levels, in addition to it being greater than work being done at last level. However,...
Why this case exists in Thompson's construction algorithm? Isn't just a special case of: where the symbol a is replaced by ϵ?
$A$ is NP-hard iff $\overline{A}$ is $coNP$-hard, where $\overline{A}$ does mean complement of $A$. I can't figure out why it is true. Let $A\in NP-hard$. I know that each problem in $NP$ is polynomially reducible to $A$. So, let's "negate" $A$, then by definition: $\overline{A}\in coNP$. However, I am not sure why...
Show that if $$NP ⊆ BPP$$ then $$NP = RP$$ Solution: It is enough to show that if $NP ⊆ BPP$ then $3SAT∈ RP$. Let $A$ be a $BPP$ algorithm for $3SAT$. Given a formula $ϕ$ with n variables, we first run $A$ on $ϕ$. If $A$ rejects, we reject. Otherwise, we try to construct a satisfying assignment for $ϕ$ one varia...
Check if $NP ⊆ BPP $ I know that if $NP ⊆ BPP $ then $NP=RP$, which is not known fact. So, we don't know if $NP ⊆ BPP$. Maybe some other explanation of this exercise ?
Check if class $PSPACE$ is closed under polyonomially space reduction Any ideas ? It is fairly difficult to prove it, because I don't understand exactly what it does mean that problems are closed under space reduction.
I have a proof but I don't know if the assumptions I did are correct. I know that $g(n)$ dominates $f(n)$, since $g(n) = \omega(f(n))$ and I did the assumption that $g(n) + f(n) = g(n)$. So, by reflexivity, $g(n) = \Omega (g(n))$. Is this correct?
Check if $P^{NP} = P^{coNP}$ To my eye answer is "unknown". I would try to show that it implies that $coNP=NP$, what is unknown fact. Lets suppose that $P^{NP} = P^{coNP}$. Then we use simply deterministic turing machine $M\in PTIME$ which use oracle. Lets launch both oracles on the same arbitrary instance. It is ...
$$T(n) = T\left(\frac{n}{2}\right) + T\left(\frac{n}{4}\right) + T\left(\frac{n}{8}\right) + n$$ How do you solve this recurrence?
By bucket sort I mean on dividing numbers between 0 and 1 into $n$ buckets and performing insertion sort on all the buckets. 1| n ← length [A] 2| For i = 1 to n do 3| Insert A[i] into list B[nA[i]] 4| For i = 0 to n-1 do 5| Sort list B with Insertion sort 6| Concatenate the lists B[0], B[1], . . B[n-1] together...
Suppose I want to generate all graphs satisfying some properties (specifically 2-connected graphs on 30 vertices with degree sequence $(4, 4, 3, 3,3, \dotsc, 3)$). Unfortunately, there are an enormous number of such graphs. Probably the fastest way to find all of them would to use nauty, but it is too slow. Is there a ...
Problem. Given 2 functions $f,~g$ of the same length $n$, decide if we can change variables in $f$ such that it will be identical to $g$. There are exponentially many non-isomorphical functions (as number of total assignments is bounded by exponent). Example. $f=(x\land y\land z)\lor(\overline x\lor z)$. $g=(x\lor\over...
Given the following algorithm for finding the second largest element in a vector: 2ndMAX(v): n = length of v largest = 0 second_largest = 0 for i in 1 to n: if v[i] > largest: second_largest = largest largest = v[i]: else if v[i] > second_largest: second_largest = v[i] return second...
I read this sentence on mit.ocw and don't understand why this completely random function would need $|U|\log n$ bits to be described? Unfortunately, if we choose a hash function h that happens to be a completely random function from U to [n], we would actually need $|U|\log n$ bits to describe it.
Consider the following problem: $L$ is the language of regular expression $00^*11^*$. $DM(L)$ is the language obtained from $L$ by throwing away every even-length string belonging to it and for each odd-length string, removing the middle character. Determine what $DM(L)$ is, and tell whether or not it is regular. Well,...
My question is related to the exercise 4.28 in the book of Nielsen and Chuang (Quantum Computation and Quantum Information). Here is the exercise For $U=V^2$ with $V$ unitary, construct a $C^5(U)$ gate analogous to that in Figure 4.10, but using no work qubits. You may use controlled-$V$ and controlled-$V^{\dagger}$ ga...
This question is about computation/computational physics. Imagine that you want to solve $10^6$ equations of motion, and you have $10^6$ degrees of freedom (position of the particle). How many RAM memory would you need (theoretically) to do this? (I am not interested in the final answer, I am just interested in the thi...
Look at solution to exercise 2, please. Exercise and solution is derieved from: https://people.eecs.berkeley.edu/~luca/cs172-07/solutions/sol8.pdf $$ShortestPath = \{(G, k, s, t)| \text{the shortest path from $s$ to > $t$ in $G$ has length $k$}\}$$ (a) Prove that $ShortestPath$ is in $NL$. (a) Solution: We constr...
Disclaimer: By asking this question i'm assuming that "memory" on a quantum computer works similarly compared to a regular computer in the sense that you can store information deterministically and when needed, retrieve it in the same way. I'm also assuming that n qubit has 2^n "states" that can be set/read independent...
I was interested in writing a program that given the number of variables and the degree of the multivariate polynomial, it was able to output the multivariate polynomial itself or evaluate it at a specific point (in reality I will feed it vectors with a value for each polynomial and I want to evaluate the polynomial). ...
For a degree sequence $(d_1,\ldots, d_n)$ with $\min d_i \geq k$ pick a graph with that degree sequence uniformly at random. What's the probability that the graph is k-connected? I know that for Erdos-Renyi graphs the k-connectivity threshold coincides with with the appearance of degree k vertices, but that doesn't say...
Let $A$ be a problem. I would like to solve $A$ in $NL$. So, I am trying to construct Turing machine working in $NL$: Let $w$ be a input of length $n$. Firstly, we run machine $M_1$ that working in $LOGSPACE$. It produces a output $o$ of length $P(n)$ where $P$ is a polynomial. Secondly, a machine $M_2$ working in $NL$...
Lets consider $$ACYCLIC = \{\langle G \rangle | G \text{ is acyclic}\}$$ We are going to prove that $ACYCLIC\in NL$. I know that the easiest approach for this task is to use the fact that $coNL=NL$. However, I wonder if correct answer is following approach: The idea is to check each existence of each length of cycle....
What is differences between deterministic and nondeterministic Turing machines? Different but equivalent models of NDTM. In particular, what is this frequently used phrase "nondeterministically guess"? How to use it right, and examples of wrong usage. My goal is to create a reference question.
Consider $L = \{(M_1,M_2):\text{the set of words accepted by both TM at the same time is finite}\}$. I want to determine if this language is decidable, semi-decidable or not semi-decidable. My thoughts My intuition tells me this is a nonRE language. Before, I showed that the same language considering the condition "th...
I understand the notion of the universal Turing machine ($U$), which receives a pair of Turing machine ($M$) and an input to $M$ ($x$). If $M$, which obtains $x$, outputs $y$, $U$, which obtains $(M, x)$, outputs $y$ as follows: $M: x \mapsto y \\ U: (M, x) \mapsto y$ My question is whether there is a theory of another...
Design a Monte Carlo algorithm that checks in constant time if a given element $x$ is in a $n$-dimensional vector $V$. Calculate the probability for a correct answer. Then suppose $n=10$, how many times the algorithm must be executed so the probability for a correct answer is greater than $0.9$? Thats what I tried. L...
According to the counting argument, most bitstrings are incompressible or only slightly compressible. However, the counting argument does not work in the opposite direction, since there are an infinite number of bitstrings that are longer. So, the counting argument does not tell us whether most bitstrings will or wil...
This may be too philosophical for this stackexchange. Chaitin's constant $\Omega$ is the probability that a bitstring will halt when run on a universal Turing machine. It is uncomputable due to the halting problem. My thought is that if $\Omega<\frac{1}{2}$ then most likely nothing would exist. So, since something do...
There is a convex polygon $X$ contained in another polygon $Z$ (which can be non-convex and even have holes). I would like to expand $X$ to a larger convex polygon $Y$ such that: $X\subseteq Y\subseteq Z$ $Y$ is maximal, i.e, there is no other convex polygon $Y'$ such that $Y\subsetneq Y' \subseteq Z$ NOTE: $Y$ does ...
Let $a$ be a large string of bits that is transmitted over a channel that introduces errors (insertions, deletions or substitutions) where the probability of an error happening is $p=0.01$ for each bit. Suppose also that each type of error has a probability of $1/3$ being chosen each time that an error is introduced to...
Let $a$ be a large string of bits that is transmitted over a channel that introduces errors (insertions, deletions or substitutions) where the probability of an error happening is $p=0.01$ for each bit. Suppose also that each type of error has a probability of $1/3$ being chosen each time that an error is introduced to...
For every two languages $L_{1}$ and $L_{2}$ over the alphabet $\{ a,b,c,d \}$, we define the language $$L_{1} \operatorname{op} L_{2} = \{ \alpha\beta \mid \text{$\alpha \in L_{1}$ and $\beta \in L_{2}$ and $|\alpha| \le |\beta|$}\}.$$ 1) If $L_{1}$ and $L_{2}$ are CFL then is $L_{1} \operatorname{op} L_{2}$ always ...
Consider a finite set $X$ and the boolean algebra $\mathcal{P}(X)$ of the subsets of $X$. While I focus on $\mathcal{P}(X)$ in this question, the problem could be expressed more generally in any boolean algebra. I have $n$ elements $P_1,P_2....P_n$ of $\mathcal{P}(X)$. I am interested in the unions of any combination o...
Binary puzzle Binary puzzle is an puzzle played on a $n × n$ grid; intially some of the cells contain a zero or a one (fixed cells); the aim of the game is to fill the remaining empty cells according to the following rules: Each cell should contain a zero or a one. No more than two si...
I was watching the "Five Stages of Accepting Constructive Mathematics" by Andrej Bauer and he says that there is two kinds of proof by contradiction (or two things that mathematicians call proof by contradiction): Assume $P$ is false... blah blah blah, contradiction. Therefore $P$ is true. Assume $P$ is true... blah ...
sum = 0; for (int i = 1; i <= n; i++ ) for (int j = 1; j <= i*i; j++) if (j % i ==0) for (int k = 0; k < j k++) sum++; I am trying to find out time complexity of this above program. First "for loop" will run n times. Second for loop will execute overall n^3 times The innermost...
I am studying for an exam and found an exercise about finding the equivalence classes for $L=a^*ba^*(ba^*ba^*)^*$, the language over $\{a,b\}^*$ with an odd number of b's. We found three equivalence classes: $[a^*], [a^*ba^*(ba^*ba^*)^*], [a^*ba^*ba^*(ba^*ba^*)^*]$. This means the minimal DFA would have three states, ...
I have this language and have to prove that its not context free: $$L = \{a^{2^kp } \mid k \in \mathbb{N}, p \text{ is prime number}\}.$$ Because it's unary, a context free language is also regular, so it should be enough to prove that this language isn't regular. Proving $a^p$ and $a^{2^k}$ aren't regular is simple. B...
In SLR we use follow set of a non terminal for determining reduce moves and in CLR we use lookaheads for the same. How does using lookaheads actually help in improving the performance of the parser ? Why is computing lookahead better than computing follow set for parsing ?
Prove that determining if a non-directed graph of $n$ vertices has or doesn't have a length $2$ path requires time $\Omega(n^2)$, assuming that the graph is represented as an adjacency matrix.
Let $L$={ $\alpha$ in {$a,b$}* | $\alpha$ has exactly two symbols b } .Prove that $L'$ = { $\alpha^n$ | $\alpha$ in $L$ ,$n \ge$0} is not context-free.I was thinking to prove it that way: Since $a^nba^nba^n$ is in $L$ then $a^{n^2}b^na^{n^2}b^na^{n^2}$ is in $L'$.Now I will use the pumping lemma for the language $L'$ ...
Let's say we have a card game, like poker. Inputs are board cards and an array of cards strength(that is calculated based on the board cards and game rules). For example for 3 ranks(A, K, Q) /2 suits(h,s) simplified poker(Leduc) with Qs on board as input we will have a strength array [2, 2, 1, 1, -1, 3] indexes are [A...
Given the image of an adhesive tape as below, what would be possible method to find the tape radius? The image sepia toned with artificial background added. The tape itself is partially hidden.
Generally computer programmers who are mathematicians or have mathematics background are very good in terms of algorithms and computer programming in general. What I am not saying: Mathematics is needed to be a good computer programmer. Mathematics is necessary for programming. Good mathematicians are good programmers ...
I have a question about the Pumping lemma. Condition $2$ of the pumping lemma for a string division $xyz$ states that the middle portion of the string $y^i$ can be 'pumped' for any $i$ greater than or equal to $0$. This means that y can be the empty string and yet still belong to the language. At the same time, the car...
Q: Suppose a language A is NP-complete. Is this following statement correct?: A: If there is a polynomial algorithm to solve A, then it can be used to all the problems in NP. My (and some others) first thoughts were that this answer is correct. But if you look at the following picture you can see that there exist probl...
Does the characterisation of an algorithm for $n$ items as in-place imply space ∊ $ο(n)$ formally informally ("among coders")?
I would like to seek help on the complexity of the following problem. Given positive integers $m$, $n$, $D_1$ and $D_2$, find all sequences $a_1\lt a_2 \lt \dots \lt a_n$ are there such that: each $a_i\in\{1, \dots, m\}$ $\sum_{i=1}^n a_i = D_1$ $\sum_{i=1}^n a_i^2 = D_2$. I want to know the complexity with respect...
In this diagram, I have a doubt in the 2nd picture. How can different languages have same independent code optimizer ? I think that different languages will have their own code optimizer(different) and then the optimized code will be converted to target machine code based on different machines. So the arrow should be...
I was wondering if this language is regular L={$a^{2m+k}b^{3n+l}c^{m+n}$ & $ k>2 $ & $ l \le 3$ & $m,n \in \mathbb{N}$} .I think the regular expression is : $(aa)^*aaa(a)^*(bbb)^* \cdot ({e} \cup {b} \cup {bb} \cup {bbb} ) \cdot (c)^* $ .Am I correct?
I'm doing an online course in which I'm struggling with the following multiple-choice question: Suppose $ T $ is a minimum spanning tree of the connected graph $ G $. Let $ H $ be a connected induced subgraph of $ G $. (I.e., $ H $ is obtained from $ G $ by taking some subset $ S \subseteq V $ of vertices, and taking ...
The complexity classes P, NP, and PSPACE are closed under polynomial-time reduction. The complexity classes L, NL, P, NP and PSPACE are closed under log-space reduction. I wonder if NPSPACE is also closed under polynomial-time reduction and/or under log-space reduction.
I've recently been studying MIPS as part of a CS course, but something bugs me. We've seen so far that MIPS increments the PC by 4 each cycle because each word is in fact comprised of 4 bytes (32 bits), each with their own address. I've also seen that a theoretical RISC machine has instructions that should only take a...
I have a grocery dotted list of pairs which are missing items that I need and I don't have any of them, so I am going to the supermarket. Each pair in the dotted list is the name of the missing item that I need and a natural number which is the quantity/amount i.e. how many of this item I need. I am in the supermarket ...
Let $0\le q<p\le \frac{1}{2}$, and let $P,Q$ be two Bernoulli Random Variables such that: $$Pr[P=1]=p ; Pr[P=0]=1-p$$ and $$Pr[Q=1]=q ; Pr[Q=0]=1-q$$ My question: Does it follow that, for any $\epsilon>0$ and $n$ as large as desired $|A_\epsilon^{(n)}(Q)|<|A_\epsilon^{(n)}(P)|$? I.e., that the Typical Set of $P$ is lar...
Let we have a 3CNF under following restriction: each variable occurs 3 times. Then I apply generalized resolution (GR) (I don't know which name would fit more) technique (number of clauses can be arbitrary large, just an example): $(x\lor A)\land(x\lor B)\land(\overline x\lor C)=(A\lor C)\land(B\lor C)$. Here $A,B,C$ a...
I need to verify some assertions about the minimalist Turing-complete language Jot. Many of the assertions I want to investigate are semi-deciable (co-recursively enumerable). So far it's been fairly straightforward to literally enumerate every Jot program via its Goedel number and testing the assertion's complement by...
Say you have a (context-free) grammar, and you wish to mathematically model the magnitude of the ambiguity possible under this grammar, across the space of all possible** input strings. Practically, one can feed in a large number of inputs strings to a parser of the grammar, and get a distribution over that set of inp...
IEEE Std 754-2008 is the modern definition of Floating-Point Arithmetic. It requires that division (among other operations) performs as if it first produced an intermediate result correct to infinite precision (..), and then rounded that intermediate result, if necessary, to fit in the destination’s format. I ask for...
From my understanding, Turing complete means that the program or machine can complete any computation that a Turing machine can complete, which to me means any computation. So how can something like HTML or PowerPoint be Turing complete?
Using the graph representation with (node, [list of neighbours]), to show that two graphs are isomorphic it is sufficient to: show that the vertices have the same degree and for every pair of vertices with the same degree, the degrees of the nodes in their adjacency list must be the same. The last point was a bit amb...
So I’m currently working on something and I have converted all decimal digits 0-9 into binary. But now I want to take say 6 in binary and increase its order of magnitude by base 10 (turning 6 into 60) without converting back to base 10. Is this possible and if so is there a way to do it with any number, X --> X0 ? EDIT...
There are four types of top-down parsers according to this answer: recursive descent backtracking recursive descent predictive table-driven with backtracking table-driven predictive. Also the author says that: All top down parsers are LL However, in this answer the author seem to associate the LL parser with table...
Let $\Sigma$ be an alphabet, and let $x^+,x^-_1,\dots,x^-_n \in \Sigma^*$ be strings over that alphabet. Call a string $s \in \Sigma^*$ good if $s$ is a subsequence of $x^+$ but not a subsequence of any of $x^-_1,\dots,x^-_n$. Given $x^+,x^-_1,\dots,x^-_n$, I am looking to find the shortest good string $s$. Is there ...
I have seen 2 answers in stackoverflow: A "trivial" property is one that holds either for all languages or for none. The property is trivial if it contains every TM, or if it is empty. My problem is: Saying that a property is trivial if it contains every TM is not the same as saying that a property is trivial if it c...
All references I find about the ANOTHER HAMILTONIAN CIRCUIT problem: Given a graph and a hamiltonian circuit on it, is there another hamiltonian circuit on it? I was trying to reduce it to the hamiltonian circuit problem but I always need to add too many or too few circuits to the original one. Am I going through ...
Let $\Sigma = \{a, b\}$. For each of the following languages, find a grammar that generates it. (a) $L_1 = \{a^n b^m : n\geq 0, m>n\}$ (b) $L_1^3$ (C) $L_1^*$ I know the grammar for the language $L_1$, that is $S \rightarrow aSb \mid bA$ $A \rightarrow bA \mid \epsilon$ please help me to find the grammars for another t...
Let us assume that we have a 2CNF $\varphi(X,y)$. Then we want to see if there is equal formula where $y$ (or $\overline y$) is pure literal. Can this be done in polynomial time? Are there some criteria for understanding this? Can we say if any minimal CNF has $y$ as pure literal, then all of them do? Simple example: $...
$L = \{ w: |w| \bmod 3 \geq |w| \bmod 2 \}$ I know, when the length of strings is not $3, 9, 15, 21,\dots,$ they will be members of the given language but unable to write a grammar for this language. Please confirm one more thing, that this given language is regular?
Big-O describes an upper bound on run time. Is that not the definition of "worst-case"? For example, how can we say that a hash table insertion require O(1) time on average? Constant time is the best case, n time is the worst case. How can an upper bound describe an average run time? In what sense is that bound "upper"...
If we do not allow unit clauses, can 2CNF containing 3 occurences per variable be unsatisfiable? Every time I try to connect opposing variables to a cycle, I need to draw 4 edges for at least one variable (2 per positive and negative occurences). So, is it even possible?
The following algo is a simplified version of a text justification algo taken from dynamic programming lecture notes of MIT OCW. I am confused why this particular algo has a time complexity of $\mathcal{O}(n^2)$ and not of $\mathcal{O}(n!)$ -: function foo(int index) { //some constant time operation like 2+2 fo...
filter() in functional programming can be thought of as being analogous to an equation that filters the range of the variable. map() can be through of as a function mapping domain to codomain. reduce() is the only one I have a problem with. To me it just seems to be a special instance of map / function, where $R^{n} \r...
In Elements of Programming Interviews, authors talk about a tip for understanding how to use primitive types (int, double, etc). Be aware that commutativity and associativity can be used to perform operations in parallel and reorder operations. I'm having trouble even imagining what these means in the context of bits...
The following problem appeared while trying to distribute a program over a cluster of computers: Given an undirected graph $G=(V,E)$ and an integer $n$, partition the vertices of $G$ into $n$ partitions $V_i$ of about equal size such that the number of edges crossing partition boundaries is minimised. You can imagine $...
Let's say we have a context free language, the CFG that produces it. And then we have a DFA for a regular language. If the intersection is empty is decidable, but how and how efficiently? And if you could be so kind, please explain the best known algorithm as simple as you can?
I have some confusion about 3.2-4 in CLRS. Here is the question : Is the function $\left\lceil \log { n } \right\rceil !$ polynomially bounded? Is the function $\left\lceil \log { \log { n } } \right\rceil !$ polynomially bounded? Here is the official answer: There is a point I can't understand.Why $\left\lceil l...
We know that if $B$ is in $P$ and if $A \leq_p B$ then $A$ is in $P$ too. If $B$ is in $SPACE(n^2)$ and $A \leq_p B$ then so $A$ will be in $SPACE(n^2)$? I think that the answer to this question is true, because if $A\in P$ then $A \in PSPACE$, and then $A$ could be in $SPACE(n^2)$. I doubt my answer because of that $...
Given that 3-colouring and 4-colouring are NP-complete show that the aproximation threshold of the minimal colouring problem is greater or equal than $\frac{4}{3}$. My current approach is to work by contradiction assuming there was such an algorithm that in polynomial time can produce a $\delta$-aproximation with...
AFAIU types can be a Set whose elements are programs or a proposition whose elements are Proofs. So based on this understanding: Inductive prod (X Y: Type) : Set := | pair: X -> Y -> prod X Y. Following code should compile but it does not due to the following error. If I change Set with Type or the other Type with Se...
I was recently in an interview and was asked what would be the smallest memory foot print and fastest system to check if a given phone number is in your data store given that all phone numbers will only be 7 digits. I was told the answer is a byte but, I'm still not 100% sure how this would work and have not been able ...
Strings are known to not satisfy the commutative property. pq is not equal qp unless p is empty string. Is there a case where pq can be qp where both are non empty strings and p and q are distinct
One of the advantage of using a features reduction/sub feature selection is to avoid a high dimentionality. The most known method is the Forward selection, where it finds the best combinations of features among others, iteratively. Now please have a look at this picture retrieved from a ppt slide on the internet. The ...
Recall the notion of NPO problem. An NPO problem is simple if the following is true: $\forall k \in \mathbb{N}^*. (\forall x. OPT(x) \leq k) \in P$ In words, given any positive integer $k$, the problem of deciding if for instance $x$ its optimal is less or equal than k is in $P$. I'm asked to show the MAXIMUM CLIQUE ...
I read the following solution for Showing that $\mathrm{NP}$ is closed under union and they used the same $c$ for both the verifies $V_1$ and $V_2$. Why is it correct? Let $L_1$ and $L_2$ be languages in $\mathrm{NP}$. Also, for $i = 1, 2$ let $V_i(x, c)$ be an algorithm that, for a string $x$ and a possible certifica...
Apologies if this is a duplicate. I searched for some time and the closest I could find was the Knapsack Problem, which does not fit because I have a fixed team size & a different value function. I have $N \approx 50$ Pokémon, from which I need to choose a team of six to attack an enemy. Each pokemon can survive for a ...
I am aware that satisfiability is NP complete and unsatisfiability is co-NP complete. But somehow I feel that labeling satisfiability as NP-complete and unsatisfiability as co-NP complete is papering over the fact that unsatisfiability (or equivalently validity) is inherently a harder problem than satisfiability. Suppo...
Context I'm designing a language which implements lambda calculus and (first-order) predicate calculus, where lambdas behave as the abstraction encapsulating logic, compositionally forming a computational model for higher-order logic. Question How does one, in general, choose between operational, denotational, and ax...
The questions is pretty simple: Given a sorted array of N elements, what is the average number of comparisons made in order to add a new element (let's call it x) in its correct position? I am using linear search for that task. So far, I've tried to solve it this way: # of Comparisons Probability of A[i] > x (Not s...
[Updates: Thanks for @Raphael 's notification, I delete the screenshot of the book and type the $LaTex$ materials] In Sisper's Intro to the theory of Computation, there is a reduction method via Computation History. He proves theorem 5.10 and 5.13 (3rd edition, page223) by that method. (I append the related part at the...
This is pretty fundamental but I'm getting confused. Let $U$ be the Universal Turing Machine and $L_{u}$ the language it accepts which is recursively enumerable. Obviously we are not able to construct the machine for its complement i.e. for $\bar{L_{u}}$, otherwise the whole theory crashes but still let's try. Let $V$ ...
Short-circuit evaluation is a straight forward subject for lazy evaluation on Boolean expressions, I noted that two factors could be useful in ordering Boolean functions to improve run-time. But this is applicable in a very particular hypothesis: Knowing a percentage of positive (hence negative) result of a function....