instruction
stringlengths
35
29.1k
I worked a bit on this and got this-: S->ABC A->aA/a B->bB/b C->cC/c The obvious problem here is I am unable to count number of a's and c's which should be equal. How do I create a cfg that can count a and c's and make them equal? Please guide. If this was $a^i b^i c^j$ I could make a cfg.
Suppose we have $k$ $n\times n$ matrices $A,B,C,\ldots$. Is there a way to compute/approximate the trace of their product much faster than computing/approximating the full matrix product? IE, computing $$\text{tr}(ABC\ldots)$$ A related problem of computing vector matrix product $v'ABC$ can be done in $O(n^2)$ time by ...
I know that each character ("in the macro level") is comprised of at least two bits ("in the micro level"). But are these bits of this "micro, electrical-logical level" have been considered "characters" by themselves anywhere in the literature and would it make any sense to define them as such?
If you need some context-: https://www.andrew.cmu.edu/user/ko/pdfs/lecture-11.pdf around page 7. Case 1-: Say vxy contains ab So when I pump v and y, what will get pumped? And how the result would be. I can understand the case for when vxy is all a's, all b's or all c's. Case 2-: Say vxy contains bc When I pump v and ...
Theorem: Prove every number in double precision 32-bit floating-point format can be represented in double precision 64-bit floating point-format. 64-bit format: Attempt: Let $ b = b_0 ,...,b_{31} $ be a binary string of 32 bits. Define a binary string of 64-bits $ a = a_0,...,a_{63} $ as follows: $ a_0 = b_0 $, $ ~~~~...
We defined the diagonal language as follows in the lecture: \begin{align*} L_{\text{diag}}=\left\{w \in \left\{0, 1\right\} ^{*}\mid w=w_{i} \text{ for some }i \in \mathbb{N} \text{ and }M_{i} \text{ does not accept }w_{i}\right\} .\end{align*} Here, $w_i$ is the $i$-th word in canonical order and $M_i$ is the $i$th ...
I have run into a little problem that I have been pondering about, and can't figure out a good solution for. Let's say that I have a set of numbers like this one: [1, 2, 3, 4, 6, 9, 8, 12, 5, 10, 15, 18, 7, 14, 21, 16, 24, 27, 20, 30, 11, 22,25, 33, 36, 13, 26, 39, 28, 42, 45, 32, 48, 50] I then get a number n, which ...
In general, how can I verify that my many-one reduction is a LogSpace reduction? E.g. I was looking at the proof of HORN-SAT is P-complete via logspace reduction. It would be ok even if someone makes me a simple example of LogSpace reduction clearly explaining why it is LogSpace and not polynomial. Many thanks.
Given: Set $N = \{0, \ldots, n-1\}, k \in \mathbb{N}, d_{ij} \geq 0$ with $d_{ii} = 0$. Task: Find subset $C \subseteq N, |C| \leq k$ that minimizes $\max_{i \in N} \min_{j \in C} d_{ij}$. Idea: I define $x_i$ with $x_i = 1$ if $i \in C$ and zero otherwise, constrained by $\sum_{i \in N} x_i \leq k$. Now I want to defi...
Let $S$ be a set of partial preorders over a set $U$ ($\le$ is a preorder/quasiorder if $\forall x,y,z\in U$, $x\le x$ and $x \le y \land y \le z \implies x \le z$). We say that a partial preorder represents a total preorder if the former is contained in the latter [1]. We say that a set of partial preorders covers a t...
I've been scratching my head with this one for a few hours now, but am feeling to stupid to comprehend how it is to be done. I can't understand the way even the state table should be built for this one. From where should I start?
Consider a $2^n \times 2^n$ Walsh-Hadamard matrix (via Sylvester's construction). Fix a set $S \subset [2^n]$ of $k\leq 2^{n-1}$ columns. Consider the rows in the $2^n \times k$ submatrix $H'$ that's obtained by dropping all columns not in $S$. Then we have $2^n$ many $k$-long row vectors. Consider the equivalence rela...
When I compute the the eigenvalues of the matrix $$\begin{bmatrix}x^3& 2 + x^3& 3 - 2 x^3\\ 2 + x^3& 4 - 5 x^3& 5 + 3 x^3\\ 3 - 2 x^3& 5 + 3 x^3& x^3\end{bmatrix}$$ using WolframAlpha, I get the following first eigenvalue (copied from WolframAlpha): λ_1 = 1/3 (4 - 3 x^3) + 1/3 (-432 x^9 - 1449 x^6 + 810 x^3 + 3 sqrt(3)...
I have a few board games where in each round one can do a set of action. Depending on the previous actions, the set of possible actions is different. Usually after a fixed amount of rounds, the game is finished and one computes the total number of points. One such game is Nidavellir (draft blog post), where one plays e...
Basically the title. I am supposed to find a regular grammar for the language that produces palindromes. This is all I have right now: S -> 1 | 0 | ε Since it should be a regular grammar, I can't write 0S0 or 1S1. But then I don't know how I should even continue with this...
In the definition of the class $\mathcal{BQP}$ found in textbooks we (as the circuit builders) have access to an unlimited number of deterministic zero-initialized qubits and to a finite set of quantum gets (it turns out that some sets of gates are universal). I'm struggling to make the definition of $\mathcal{BQP}$ in...
I want to prove that for every positive polynomial $p(n)$ and any negligible function $negl(n)$ the product $negl(n)p(n)$ is also negligible. This is what I tried so far: $\forall n>n_0:negl(n)<1/k(n),k=$any positive polynomial. $\Rightarrow p(n)negl(n)<p(n)1/z(n) $ With $z(n)=p(n)k(n)$ $\Rightarrow p(n)negl(n)<p(n)1/z...
Yesterday I started reading "An Introduction To The Analysis of Algorithms" by Sedgewick/Flajolet. For me it was not clear what he meant with "theory of algorithms" and the "scientific approach". I googled a bit and found someone who had the same question: Sedgewick analysis of algorithm, difference between theory of a...
Is there an easy/intuitive way to understand why the algorithm for transforming an infix expression to a postfix expression using a stack works?
I'm a bit confused by the role of the empty string in this ambiguous grammar: A' -> A A -> if A B A -> null B -> [empty string] B -> else S So what does B -> empty string mean/do? Does that mean B could transition to A? And "if", "else", and "null are terminals, then what is the empty string?
Suppose given an array $A[1..n]$ that contains $k$ distinct element, why the lower bound for sorting of this instance is $\Omega(n\log k)$? I think according the decision tree the lower bound is $$log \frac{n!}{(n-k)!}.$$ But I can't achive $\Omega(n\log k)$.
I have an $n\times n$ matrix, and want to find a bijective function $h:[n^2] \to [n]\times [n]$ that can act as a hash function to map the numbers 1 through $n^2$ to row/column indices in my matrix. The additional property I'm looking for is that any two close input values should map to matrix indices that are far apar...
I've done my due dilligence and tried to answer this question using every resource I could get. KhanAcademy, NesoAcademy, and Rosen's Discrete Mathematics book. I still can't wrap my head around it. Here is how I answered it: Let x be things you did to me. Let y be you making me happy. Let P(x,y) be the thing you did t...
I have read that NAND gate and NOR gate are called universal gates... but i cannot find a rigorous proof that any circuit can be designed by these two gates only.
Let's say we have a set of n integers. I'm trying to find a way to partition this set into m subsets (empty subsets are not allowed), so that the maximum subset-sum gets minimized. for example, let's say we have the following set and m = 2: {11, 5, 11, 5, 10} the optimal partitioning will be as follows: {5, 5, 11}, {10...
Given algebraic expression in a string, I want to split it into a list of operations for building a parallel binary tree. For example, I'm trying to convert expression such as: (a+b+c+d)/(e*f) or same expression in postfix notation: ab+c+d+ef*/ into a list of Expr1 = 'a+b' Expr2 = 'c+d' Expr3 = 'e*f' Expr4 = 'E...
I am working with a shortened version of $[n,k,d]$ Reed-Solomon code. I am encoding a message of size $k−l$ which gives a shortened code of size $n−l$ (this is equivalent to encoding the same message appended with $l$ $0s$). While decoding, I am following the Patterson algorithm, i.e. find $(n−k)$ syndromes, construct ...
Calling all math buffs! ;) A Turing machine has two states - one accepting and one non-accepting. Furthermore, the Turing machine cannot overwrite blank symbols. (Note: It's assumed that the blank symbol surrounds the input on the band and isn't itself part of any input string) Show that the given Turing machine can on...
Suppose given a weighted directed graph $G=(V,E)$. We want, for each $v\in V$ find a path $P$ from other vertices to $v$ such that weight of $P$ is minimzed. I can solve this by running Johnson's algorithm on $G$ and doing a linear traverse of matrix to find out for each $v$ minimum weight shortest path from other to $...
I came across this question in my Theory of Computation class recently: Consider a regular language $L$, and define $X = \{x:xxx\in L\}$. Is this language regular? I believe that it is regular, and that the procedure required to construct an NFA for it is not particularly different from constructing one for $W=\{x:xx...
I'm trying to make a huffman tree based off of some words. I have the frequencies of each character stored using a hashtable, but i need to then make a minheap structure in order to then be able to make the huffman tree. What I don't get is how I am supposed to actually use the minheap because I don't understand how I ...
I'm trying to figure out all elements of a symmetry group for the acyclic oriented $L$-cube. I do have an algorithm, but its complexity is not suitable for larger $L$. I computed $L=5$ on my old Laptop (took 30min, non-optimized code, single thread). I can imagine $L=6, 7$ or maybe $L=8$ is possible, higher once certai...
I am struggling with the following remark from lecture: Suppose the Polynomial Hierarchy collapses at the $i$-th level, i.e. $\Sigma_i^P = \Sigma_{i+1}^P$. Then for all $k \ge i$ holds $\Sigma_k^P = \Sigma_{k+1}^P$. The only similar relation I know of is $\Sigma_i^P \subseteq \Pi_{i+1}^P \subseteq \Sigma_{i+2}^P$ hol...
In the image, the language of the TM is defined on (a, b, c, d) and there is no transition on final state, but strings consisting of d are also part of the language. In all TM problems I have seen until now, all transitions not defined are considered to go to the rejecting state (qrej.). So in this TM also any transiti...
I created a 2x2 2D-array of 0's as follows: sizes=[[0]*2]*2 sizes [[0, 0], [0, 0]] I want to change the second element of the first row to 1. I do this as follows: sizes[0][1]=1 Unfortunately, the second element of the second row also changes to 1. sizes [[0, 1], [0, 1]] Why does this happen?
I'm studying Autoamta Theory currently and am wondering if any Language (for example Lanugage L in Alphabet A={a,b}) can be expressed by regular expression. In my current understanding the rule is "L is acceptable by Automaton <=> L is rational" But does that automatically mean that for every regular L there is also a ...
Let $T$ be an infinite countable labelled transition system with the shape of a tree and let $\sim$ be its similarity relation among nodes. Note that the alphabet of the labels is finite (hence the tree has finite branching). Let $T/\sim$ be its quotient w.r.t. the similarity relation, i.e. two nodes in $T$ are identif...
I'm new to network flows and I'm reading this topic from Cormen's Algorithms book (3rd edition) from 26 chapter. I came across this problem from the 26.1 section Suppose that, in addition to edge capacities, a flow network has vertex capacities. That is each vertex has a limit $l$ on how much flow can pass though . S...
Confused with this proof. I will point my confusions here. what is R(M)? They say it is representation of turing machine but what is it exactly? Is it tuples of turing machine? How do we decide w is input here? Because later when doing R(M)*R(M) we call R(M) as input. how can we just assume that H'-: when M halts wit...
Are there any FNP-complete problems where there's only one possible solution? For example, the travelling salesman problem can have multiple routes all shorter than $X$. There's only one shortest route, but it can't be validated that a given route is the shortest route in polynomial time. I'm interested in either such ...
I have a graph $G=\left(V , E\right)$ and source $s$ and target $t$. I also have a weight function $w: V\rightarrow \mathbb{R^+}^k$, meaning a vertex given $k$ non negative weights. There is an upper bound vector $C \in \mathbb{R^+}^k$. The problem definition is to find a path from $s$ to $t$ such that it is not too he...
I've been wondering about this problem for a while: Say we have L = { <M>, n | M has to halt for at least n Inputs} and multitapes are simulating various inputs bla bla How do I count how many Simulations came to a halt? My guess was to have another tape that has e.g. n zeros as Input and whenever a Simulation comes to...
I am aware that 2SAT is polynomial while 3SAT is not, but I am looking for an intuition why its so. After all, even in 2SAT we can attempt all possible truth functions and its $2^n$. So I am hoping not for a formal proof, but for intuition or explanations that distinguishes the language from 3SAT?
I have a question about determining preconditions for Hoare's Axiom Scheme. For example, if we have P { x=2 } x==1 and we are trying to determine the precondition, P, could we just set P as false giving us False { x=2 } x==1. I've read some of the other posts on this forum about Hoare's Axiom Scheme but am having a har...
Let suppose we order the nodes first by degree (in + out), to get a list of node structures: Node: labels: [] # lexicographic ordered out_arrows: [] # ordered by ordering of the nodes in_arrows: [] # ordered by ordering of the nodes Then how should we order the nodes that have equal degree? Or am I appr...
How to calculate the number of Integers that can be represent in Double-Precision floating-point form?
Suppose we are computing a sum over $n$ factors which can be represented as a planar tensor network. What is the complexity of finding an optimal elimination order? For example, take the following summation over 5 variables: $$\sum_{v1,v2,v3,v4,v5} f_1(v_1,v_5)f_2(v_1,v_2,v_3)f_3(v_3,v_4)f_4(v_2,v_4,v_5)$$ Each variabl...
Here is a simple but very common grammar rule case in EBNF format, the Statements is a none terminal symbol and Statement is none terminal symbol: Statements ::= (Statement ';')* After converting this rule to NFA, and then do the subset contruction for converting the NFA to DFA, and at last get the dfa: State0 -> Stat...
How can a directed graph be efficiently represented in a purely functional language like Haskell? Could someone suggest relevant materials on this topic? (functional pearls perhaps?) Thanks.
I am unable to understand why do we need to encode turing machine at all? I heard that we are trying to build a programmeable turing machine but can't relate how encoding it will make this programmeable. Please share some insights. PS I have seen different encoding in different slides, are all encodings fine? https:/...
Suppose given two strings $s_1$ and $s_2$ each of length $n$. We consider $s_1$ and $s_2$ as dual, if one of the following conditions satisfied: Strings are equal. Else, if $n$ is even then: Divide $s_1$ into two equal partitions $a_1,a_2$, also divide $s_2$ into $b_1,b_2$ then: $a_1$ with $b_1$ and $a_2$ with $b_2$...
The query-equivalence problem is undecidable. However there are theorem provers that attempt to solve instances of undecidable problems. I am curious how I could go about using an automatic theorem prover (or other solvers) to prove that one MongoDB query is equivalent to another. The MongoDB query language is large, s...
I would like a name for the following problem. We consider a relaxed vertex coloring problem, where Let $k$ be the number of colors Let $B$ be the set of edges violating coloring, i.e., $$B := \{(u,v) \in E \mid c(u) = c(v)\}$$ Then the objective is something like $k + \beta |B| \to \min$ over all colorings (for som...
Context: Consider $M$ finite state systems with evolution given by: $$ x^i_{k+1} = f(x_k^i,u_k) $$ where $x_k^i\in\{1,\dots,X\}$ is the state of system $i\in\{1,\dots,M\}$, $k\geq 0$, and $u_k\in\{1,\dots, U\}$ is some input which we can use at time $k$ to control the evolution of all systems (notice that $u_k$ is sha...
So I have a database pre-loaded with data related to food recipes and the assignment says: 'Provide an API call that allows us to specify an ingredient or set of ingredients and return full recipes containing those ingredients.' I am not sure if this means to create a webpage with a search box that would allow the clie...
I need to understand how adversary argument works to prove the lower bound of an algorithm. For now, I am looking to prove that a "certain" algorithm that takes in input array requires omega(n) comparisons. Basically it needs to compare the ith element with i+1th element, then i+1 to i+2 element and so on. The adversar...
The formal problem statement is: Given a set S of n distinct numbers and a positive integer k<=n, determine the k numbers in S closest to the median. My thoughts: I have read about the median of median algorithm, which goes like group n elements in groups of 5 and finds the median of them and then recursively finds th...
Consider a set of jobs, each having its deadlines and process time. How to find a permutation of them such that if they are executed in that sequence, they all finish before their deadline or figure out that no such permutation exists. My Thoughts: There could be some greedy strategy, but I am not sure how to arrive ...
Im specifically referring to the bully algorithm for synchronous systems, described in [Garcia-Molina 1982]. In it, the timeout for failure detection is concretely defined as the sum of the round trip time and the message processing time. Additionally, there is a separate timeout that the process must wait before re-st...
Assume I have a game actor (name it MyActor for further references) to be moved up and down according to $z=f(t)=A\sin \omega t$ (or any non constant velocity). The game engine provides us with callable GetGameTimeSinceCreation() to obtain the age of the actor. overridable Tick(float DeltaTime) in which we put our cod...
I am playing with L-System using the wonderful tool jflap. Below is the L-System for the dragon curve in the "JFLAP book: JFLAP – An Interactive Formal Languages and Automata Package " (you can find it in the left column of its homepage). What does the third rewriting rule "$g \to \lambda$" mean? I did not find any ref...
What is the definition of P, NP, NP-complete and NP-hard? here is a good answer but it really doesn't answer mym question. np-hard-: a problem A is NP hard if for all B$\in$NP, B is polynomial time reducible to A.(i.e A is easier than B). Then why is A called NP Hard? It should be called NP easy problem? Isn't it? n...
How can we actually define a polynomial-time 4-approximation algorithm for vertex cover or knapsack problem? For say we have 2 approximation problems which less than equal 2C*. But when we have a larger or 4 approximation sizes how we can derive it.
In a computer network, the store and forward mechanism is used. In this mechanism, the packet is sent from one system to the next along the network path, and in the second system, the complete packet received is checked and then sent to the next system in the network. This mechanism is quite similar to the behavior of ...
Reading the book Practical Foundations for Programming Language. In section 5.1 Transition Systems, the author said that Whereas all final states are, by convention, stuck, there may be stuck states in a transition system that are not final. Thus every complete transition sequence is maximal, but maximal sequences a...
After having searched a bit, it seems I can't find terminology or references for this outermost class, 2Σ* in blue -- see below. What is it describing?
Suppose we have $r$ copies of the integer $a$ and $t$ copies of the integer $b$, and a capacity $C$. We would like to find the maximum sum of the given integers, that is at most $C$. This is a special case of the subset sum problem. Since there are at most $(r+1)(t+1)$ possible sums, one can just check all of them and ...
Question: Consider an arbitrary directed graph $G$ with weighted vertices, the weights can be positive, negative or $0$. The prefix of $G$ is a subset of vertices $P$ such that there's no edge $(u \rightarrow v)$ if $v \in P$ and $u \not\in P$. Find an integer linear programming to describe the maximum weight prefix of...
I am working on finite state machine pruning, a problem that requires me to build finite state machines (in the manner of the Aho Corasic algorithm) to match an evolving input string against a set of suffixes. If a match occurs, the search is aborted (i.e. we don't care about outgoing transitions from accepting states...
Wikipedia's Minimum Spanning Tree reads: Minimum-cost edge If the minimum cost edge e of a graph is unique, then this edge is included in any MST. Proof: if e was not included in the MST, removing any of the (larger cost) edges in the cycle formed after adding e to the MST, would yield a spanning tree of smaller weigh...
I need help figuring out how to prove the following statement using the definition of "Big-Oh" notation which says that f ~ g if there are constants C and n_0 such that f(n) <= C*g(n), for n >= n_0. I have down below shared my attempts but am quite unsure about everything. For all I know I am not doing this correctly. ...
Consider the following problem 11.2-6 from CLRS book: Suppose we have stored $n$ keys in a hash table of size $m$, with collisions resolved by chaining, and that we know the length of each chain, including the length $L$ of the longest chain. Describe a procedure that selects a key uniformly at random from among the ke...
I have a graph theory or combinatorics problem that probably has a solution, but I haven't been able to find it. The problem can be simple: in the second figure below, choose one yellow block from each oval such that the blue edges between the blocks look like the edges in the first figure below. Find all possible such...
In the apriori algorithm there's the self join step, So, say we have 1 3 2 3 3 5 2 5 If I were to do an exhaustive join I'd end up with a tuple including (1, 3, 5) - although (1, 5) has no support. What's an efficient way to only get the wanted result of (2, 3, 5)? I had a look at the geeksforgeeks explanation, but ...
I am working on the polygon triangulation algorithms from "Computational Geometry - Algorithms and applications 3rd ed", chapter 4. I've managed to turn polygons into y-monotone polygons using the sweep line technique. For this, diagonals are added to the DCEL which ignoring any face values (which are then corrected la...
In Unix shell programming, there's the ideom: program1 && program2 && program3 where successful completion of program1 and then program2 will lead to the execution of program3. In Perl, there's 2 set of condition operators - punctuation styles &&, ||, etc., which binds more closely; and keyword style and, or, etc., wh...
This is a homework question. Consider the problem of finding if an undirected graph $G$ can have a spanning tree with no more than 50 leaves. Is this problem NP-hard? I think it is and I'm trying to prove it. So far I've tried to reduce Vertex Cover to this problem. My idea is that the internal nodes of a spanning tree...
The Task You are given $n$ columns each of length $m$. All values are either $-1$ or $1$. Find an assignment $s$ of each of columns to 1 of $m$ groups in order to maximize the sum of all the absolute values of group row sums. For example Suppose $$n=7,$$ $$m=3,$$ $$a=\left( \begin{array}{ccccccc} -1 & -1 & 1 & 1 & -1 ...
I'm in the first year of computer engineering and I feel completely lost when it comes to solving hard programming exercises. I think it's due to a bad modus operandi. And that is why I'm asking this question. My question is that: what do you do when you have to do a difficult task? In other words, what do you do when ...
Will u.f and u.d of a vertex in DFS traversal change if we change order of vertices in adjacency list ? I know that u.d won't change but what about u.f? u is a vertex of the graph. u.f, u.d are finish and discovery times of the vertex u respectively in Depth traversal search algorithm.
Can I exclude $\epsilon$? Will that make a difference. This is really confusing me. It seems everything could contain $\epsilon$. Is there some way of thinking to realize this contains $\epsilon$ or not. I was looking at a DFA for $a$ followed by $b$. And it also contained $\epsilon$ which seems confusing to me. That m...
In resolving collisions while hashing by chaining , if we store keys in the list in sorted manner, will we obtain any substantial performance in successful searches , insertion, deletion? What would be the time - complexities of these operations if we maintain sorted lists in chaining?(assume keys are integers)
I'm a computer science bachelor student tasked with understanding On the ICP Algorithm by Esther Ezra, Micha Sharir, and Alon Efrat, and I'm having a lot of difficulty with even supposedly obvious claims. The setup is as follows, wherein we only look at translation, not rotation: Let $A = \{a_1, ..., a_m\}$ and $B = \{...
Let's say that we have a language $L$ that is finite. How can I prove that the complement of $L$, i.e., $\bar{L}$, is always an infinite language? Obs.: infinite language in this case means that is possible to construct an infinite set of words that are acceptable by $\bar{L}$.
I was trying to minimize given DFA: a b -> 1 4 2 F 2 1 1 3 1 4 F 4 1 1 I've watched few videos about solving this problem and decided to use the equivalance method. While doing it I've come to the solution below: 0 Equivalance: {1,3} {2,4} 1 Equivalance: {1} {3} {2,4} a b -> 1 2,4 2,4 F ...
I just encountered this formulation of the shortest $s$-$t$ path problem as a linear program in a homework. I don't understand exactly the meaning of the variables and restrictions. Here, $G = (V, E)$ is an undirected graph with non-negative weights $w_e$. $S'$ is the set of all cuts in $G$ and $M(S)$ is the set of all...
S → aX | bX X→ aS | bS | ε This is required cfg, I want to learn how we arrived at this cfg? What steps did we follow to arrive here? Do we memorize some standard cfgs? I can derive strings using this but that is not useful when I don't know the cfg already. I have solved a cfg on my own and came up with this, if you ...
Given an undirected graph $G=\{V, E\}$ with its vertices numbered from $1$ to $V$, given two vertices $s$ and $t$ $(1 \leq s \lt t \leq V)$, what is the minimum number of vertices (except $s$ and/or $t$) that we need to remove (we also remove the edges associated with those vertices) so that there doesn't exist any pat...
Let NextPrimeNumber be an oracle that accepts a prime number n and returns the smallest prime number m such that m > n. It can be called by a Turing machine and returns the answer in constant time. Let F be the Turing Machine that receives K a positive integer as a number. Suppose its code is the following: current_pri...
I understand $R_{fa}$ etc. I understand why the diagonals are higlighted. I understand D={a,d,f}. But I don't understand what is the conclusion we derive from this?
In my opinion the contradiction should be-: If $n^2$ is even then n is even. But it is written in my discrete mathematics book that, "n is even then $n^2$ is odd". How do we find contradiction statement? This is what is written in my textbook.
Definition: Problem A is reducible to problem B if an algorithm for solving problem B efficiently (if it existed) could also be used as a subroutine to solve problem A efficiently. When this is true, solving A cannot be harder than solving B. In these reductions, a YES instance of A maps to a YES instances of B and NO...
A Boolean polynomial in $n$ variables $x_1, \dots, x_n$ is an expression of the form $$\sum_{\mathbf{s} \in \{0,1\}^n} c_{\mathbf{s}} x_1^{s_1} \cdots x_n^{s_n}, \quad \text{ where } c_s \in \{0,1\} .$$ Addition of Boolean polynomials is performed modulo $2$, while multiplication follows the distributive property and t...
Consider inverse of Ackermann function, can we conclude that the growth rate of it as the same as growth rate $\log^*n$?
I have a computer science question: Let Σ = {a} be a one-element alphabet and L ⊆ Σ^* be an arbitrary language over Σ = {a}. Show that L^* is regular These are all the facts I have been able to gather thus far: an alphabet Σ, any set L such that L ⊆ Σ ∗ is called a language over Σ Fact 1 For any alphabet Σ, any languag...
The original problem I was solving was what would the time complexity of a merge sort algorithm be, if it used a merge algorithm with complexity $\Theta(n^2)$ instead of $\Theta(n)$. The solution says the time complexity will be $\Theta(n^2)$, but I don't understand why it's not $\Theta(n^2\log n)$? I tried using a rec...
I am learning Computational Complexity. Is Knapsack-optimization problem (find an arrangement to maximize the value) known to be NP-hard, while Knapsack-search problem (find an arrangement so that value >= a number) known to be NP-complete? For the Knapsack-search problem to be NP-complete, should I have assumed that a...
For brevity, let $s(D) = \sum_{d\in D} d$ denote the sum of the elements in $D$. Given a set $A = \{a_1, \dots, a_n\}$ of positive integers, and a target value $K$, the subset sum problem is to determine if there exists a subset $A' \subseteq A$ such that $s(A') = K$. Given a set $B = \{b_1, \dots, b_m\}$ of positive i...
I'm trying to understand how to prove a language is regular or not regular, for example this language: $$L=\{a^nb^m:n,m\in\mathbb{N}\land n-m=5 \}$$ Is this language regular or not? My solution Using the pumping lemma, I can choose a string with a pumping length $p$ like: $w=a^{5+p}b^p$, then $x = a^j, y=a^l$ and $z=a^...
My question concerns the version of the Master Theorem described in CLRS and in this handout. I already understand the following: If the regularity condition in case 3 does not hold, then we can't apply case 3. If the regularity condition in case 3 holds then $f(n)=\Omega(n^{\log_ba\ +\ \epsilon})$ is definitely true....