instruction
stringlengths
35
29.1k
I was going through the text Introduction to Algorithms by Cormen et. al. where I came across the following claim: Universal Hashing uses randomization.For the example of a compiler's symbol table, we find that the programmer's choice of identifiers cannot now cause consistently poor hashing performance. Poor performa...
Malware can enter a computer in various ways, but I would like to know how it is able to simply use 0's and 1's and machine code to take over a computer and how it can stay hidden from antivirus software.
I am familiar with 0/1 knapsack problem. But if the following constraint is imposed... how do I solve the question? If you choose some item 'U' you won't be able to choose another item 'V'. For example Items are given as [Name, Weight, Value] Items are : A 10 20 B 50 80 C 20 30 D 30 70 E 50 50 If you choose B then y...
I came across this problem that I could not figure out... For every language $A$, there is supposed to be a language $B$ such that: $$ A \leq_T B $$ but: $$ B \not \leq_T A $$ If it is $A \leq_TB$ and $B \leq_T A$, this is easy since we can just let $B := \bar{A}$, but for the above I could not think of anything. Any h...
Is this language regular? ${w ∈ (a + b)∗ : |u_{a}|>= 2009 · |u_{b}|}$ for every non empty prefix $u$ of string $w$} I think it's non-regular. I tried concatenation of $L_{prefix} $={${ u : |u_{a}|> 2009 · |u_{b}|}$} and $L_{2}= a^*b^*$. $L_{2}$ is regular. I tried to show that $L_{prefix}$ is non-regular using pumping ...
prove or disprove that any turing machine which accepts language $l=\{ww | w ∈ \{0, 1\}∗ \}$ has time complexity $ω(n^2)$
I'm a Physics/C.S. student and have been struggling with this particular problem for a few days now. So the task is as following: Consider the following languages: $\hspace{20pt} L_1 = \{\langle M \rangle \, | \, L(M) = A_{TM}\} \\ \hspace{20pt} L_2 = \{\langle M \rangle \, | \, L(M) = \overline{A_{TM}}\}$ Are these d...
Input: complete, undirected graph $G=(V,E)$ and cost function $c$ Assume for all nodes $x,y,z \in V$: $c(x,z)\le c(x,y) + 100\cdot c(y,z)$ Find a 200-approximation polynomial time algorithm for the input. I've seen the regular 2-approximation algorithm for a graph that satisfies the triangle inequality. Find the MST ...
Consider the problem of determining whether a Turing machine M on an input w writes the blank symbol at first. Is this decidable ?
How exactly does the control unit in the CPU retrieves data from registers? Does it retrieve bit by bit? For example if I'm adding two numbers, A+B, how does the computation takes place in memory level?
Determine if the following problem is decidable or not : Does the read–write head of a TM with the given input w leave the word w on the tape?
I confused about the description & definition of "key" occuring as terminology for databases and b-trees. In first case dealing with theory of databases a key is defined as a choice for a in certain sense minimal (see below) subset $K \subset A := \{A_1,A_2,...,A_n\}$ of a fixed set of attributes $A_i$ parametrizing a ...
Suppose we have: $$A\text{ }\colon=\{x, y, z\}$$ $$M\text{ }\colon=\text{some DFA using A}$$ $$S\text{ }\colon=xyzxyzxyz$$ Intuitively, one might say $S$ is fed to $M$ on a per-character basis. This means that somehow we have an undisclosed mechanism that can tell where a symbol starts and ends. One might say, simply u...
I am looking for an algorithm to solve the following problem. I am unsure whether to post this in computational science or here, but since this is an algorithm I thought I would try here first. I have a set of species made from a number of components. Let's number each component $0, 1, 2 ... n$. So now each species can...
Do we have to calculate time for declaring statement, in my case int num3 statement. The following question was asked by professor as a post-lecture quiz. I selected t(n)=3, but the correct answer was t(n)=4. What is the time taken by following algorithm on RAM model ? t(n)=3 t(n)=4 t(n)=5 None of the above
I know that BFGS is a general quasi-Newton method, whereas Levenberg-Marquardt (LM) is specifically for non-linear least squares (NLLS). That said, is there a big advantage of using LM instead of BFGS for NLLS problems?
I'm working on optimizing the structure of an optical meta device. I have a randomly generated 2D matrix, where 0,1 represents the presence/absence of a hole. Each structure manipulates light differently, thus giving rise to a unique spectrum. The problem I wish to solve is to maximize the efficiency of this structure....
I'm practicing data and control dependencies, but having trouble detecting them. For this example, I'm assuming this pipeline is fully bypassed (with forwarding). I think the only data dependency is i3 on i2. Is this correct? I also don't know how to detect the control dependency. I know there will be one because of th...
Suppose I have a graph with vertices of three colors - black, gray, and white. I want to compare the connectivity between sets of vertices to make claims like - the black set is more related to the white set than the gray set, and so on. How are such claims measured? Are there standard metrics or methods for that case?...
Can anyone give an example where a language can be rejected by linear bounded automata and accepted by a Turing machine. Is there any proof that a linear bounded automata is less powerful than a Turing machine?
I've seen on Wikipedia; that set covering cannot be approximated in polynomial time to within a factor mentioned above. Unless $NP$ has quasipoly-time algorithms. Now, this must pertain to classical algorithms and does not mention any approximation algorithms that may only work in nature. (eg. Things like Amoebas solvi...
Introduction I have an optimization problem. There are up to 25 nodes. The connectivity between the nodes is far less important than the Cartesian placement of the nodes. Since all nodes can potentially affect each other in the optimization problem it is safe to model this as a complete, undirected graph. In most modes...
The question is as follows: Show that when all elements are distinct, the best-case running time of HEAPSORT is $\Omega(n\lg n)$ https://walkccc.github.io/CLRS/Chap06/6.4/ This website provides a rather complicated analysis to this question, but the obvious answer that occurred to me was far simpler. Hoping if anyone c...
Edit Distance is very well known problem in computer science. Came up with following algorithm after reading through CLRS but it doesn't work. Check the working algorithm below, I couldn't find why first algorithm doesn't work while second one does. public int find (String word1, String word2, int i, int j, int count...
We are given two grayscale images, one of which contains a large, mostly contiguous patch from the other one. The patch can be altered with noise, its levels may be stretched, etc. Here's an example We would like to determine the region of the image which was copied onto the other image. My first instinct was to look...
I am working on a problem defined as the following Given a set of $n$ elements called $R \subseteq \mathbb{N} \times \mathbb{N}$ and numbers $Z,G \in \mathbb{N}$, where $Z$ is a measure of our resources and $G$ is our necessary minimal reward, is there a set $R' \subseteq R$, so that $\sum_{(z,g)\in R'}z \leq Z$ and $\...
Using big- O notation estimate in terms of a simple function of $ n $ the number of bit operations required to compute $3^n$ in binary. I need some help with the above question. The number of bit operations required to multiply two k- bit numbers is $O(k^2)$. In the first step I am multiplying two 2-bit numbers, i...
Consider $L = \{\langle L_1, L_2\rangle\mid L_1, L_2 \in \text{CFL} \text{ and } L_1 \cap L_2 = \emptyset \}$. How to prove that $L \notin R $? $L_1, L_2$ encoded in chomsky-normal-form.
How can I prove the next claim: If a language $L$ meets the pumping lemma for regular languages then $L$ meets the pumping lemma for context-free languages? (Without any pre-condition about the regularity of $L$)
I recently learned about the Arthur-Merlin protocol, and we defined the complexity classes $AM,MA$. We have also seen that there exists a theorem stating that $AMAMAM...AM=AM$, however we have not formally defined $AMAMAMAM...AM$. We did give a brief definition for it as a protocol, but i would like to see a formal def...
A visibility graph $G(P) = (V,E)$ of a set $P = \{p_1, \dots, p_n\}$ of points is defined as follows. Each vertex $u \in V$ corresponds to a point $p_u \in P$. There exists an edge $uv \in E$ if, and only if the line segment $\overline{p_up_v}$ does not contain any other points in $P$. Assume that the coordinates of ...
I learnt that in a order-statistic tree (augmented Red-Black Tree, in which each node $x$ contains an extra field denoting the number of nodes in the sub-tree rooted at $x$) finding the $i$ th order statistics can be done in $O(lg(n))$ time in the worst case. Now in case of an array representing the dynamic set of elem...
As described in the reference, the algorithm (see at the bottom) supposes to output an estimator $\hat T$ for the # of triangles in a given graph $G = (V, E)$, denoted $T$. It is written that "it can easily be shown" that $$ E[\hat T] = T $$ But unfortunately, I'm not seeing it. Trying to analyze $E[\hat T]$, I think a...
I am reading up on algorithms and at the moment looking at the below problem from Jeff Erickson's book Algorithms. I solved (a) by seeing a relationship to the previous problem on computing the number of array inversions. However, I am struggling with problem (b) as I cannot see how to reduce the circle point arrangem...
I'm trying to create a list curation web app. One thing that's important to me is being able to drag-and-drop reorder items in the list easily. At first I thought I could just store the order of each item, but with the reordering requirements, that would mean renumbering everything with a higher order (down the list) t...
I've recently learned about Prolog and Logic programming which I find pretty cool, but the compiler is currently like magic to me and I want to know how they work. After a little bit of research I discovered that logical compilers are based on Warrens Abstract Machine (WAM). I've tried to find some information on WAM, ...
Michael Sipser offers the definition: The pumping lemma says that every regular language has a pumping length p, such that every string in the language can be pumped if it has length p or more. If p is a pumping length for language A, so is any length p′ ≥ p. The minimum pumping length for A is the smallest p that is a...
I was going through the Dynamic Programming section of Introduction to Algorithms (2nd Edition) by Cormen et. al. where I came across the following recurrence relations in the context of assembly line scheduling (Note: Assembly line scheduling or dynamic programming is not required to answer to the question though, it ...
I am learning $\lambda \mu$-calculus (self-study). I learned it because it seems very useful for understanding Curry-Howard correspondence (e.g understanding the connection between classical logic and intuitionistic logic) I searched the internet, there is some information about $\lambda \mu$-calculus on Wikipedia, bu...
I can't figure out what the notation $[x \neq k ]$ means. Here's a bit of context: The formula is: $Pr[A_i^k = 1] = \frac{[i\neq k]}{|k-i| + 1} = \begin{cases} \frac{1}{k-i+1} \text{ if } i \lt k \\ 0 \text { if } i = k \\ \frac{1}{i-k+1} \text{ if } i \gt k \end{cases}$ and is part of a chapter where the average ex...
I found a paper titled Multimodal representation: Kneser-Ney Smoothing/Skip-Gram based neural language model. I am curious about how the Kneser-Ney Smoothing technique can be integrated into a feed-forward neural language model with one linear hidden layer and a softmax activation. What is the purpose of the Kneser-Ney...
I'm currently trying to understand an implementation of CRC32 about which I have a question. On this page at section 6, there is the following code: public uint Compute_CRC32_Simple(byte[] bytes) { const uint polynomial = 0x04C11DB7; /* divisor is 32bit */ uint crc = 0; /* CRC value is 32bit */ foreach (by...
As posed in the question; the statement naively seems like it should be self-evident but there are no algorithms that come immediately to mind. Suppose I have some domain $A$ (in my case a subset of $\mathbb{Z}^n$ for some $n$, but I would expect any answer to be independent of that structure), and a domain $B\subset A...
I came across this problem which asks to show the existence of two disjoint Turing-recognizable sets $A$ and $B$ such that no decidable set $C$ can separate them... In this case, a set $C$ is said to separate $A$ and $B$ if $A \subseteq C$ and $B \subseteq \overline{C}$ ... If only $A$ is Turing-recognizable, then we c...
Assume we run Prim’s algorithm when we know all the weights are integers in the range {1, ...W} for W, which is logarithmic in |V|. Can you improve Prim’s running time? When saying 'Improving', it means to at-least: $$O(|E|)$$ My question is - without using priority queue, is it even possible? Currently, we learned th...
As discussed here Johnson's Algorithm can be used to solve the APSP-Problem in $O(V^2\log V + VE)$ in stead of $O(V^3)$ for Floyd-Warshall. However, Johnsons Algorithm does quite a bit of work for the case that some weights are negative. Is there a faster way to compute this given that all weights are positive?
Let $G = (V, E)$ be an undirected graph and $U \subseteq V$ some subset of its vertices. An induced graph $G[U]$ is graph created from $G$ by removing all vertices that are not part of the set $U$. I want to find a polynomial time algorithm that has graph $G = (V, E)$ and integer $k$ as input and returns a maximum set...
In p. 7 of the book "Introduction to Information Retrieval" (by Manning et al), the authors explain how, given a collection of text documents, an inverted index is built by tokenizing, then sorting the (term, docID) pairs, merging multiple occurrences of the same pairs, and the pairs for each term are grouped into a p...
What subfields in computer sciences may one study without learning Object Oriented Programming or is there some kind of degree in Computer Science without the OOP knowledge requirement? Is there a language without OOP? Does one need to know OOP to simulate a CPU? I wanted to earn a CS degree without ever learning OOP. ...
I'm trying to figure out whether infinite language change the answer. Show that the following language is decidable: $$L=\{\langle A,B \rangle : \text{$A,B$ are DFAs, $L(B)$ is finite, and $L(A)/ L(B)=L(0^*1^*)$}\}.$$ (I am talking about right division.) We know how to check whether the language of a DFA is finite, a...
I went through the Master Theorum extension for floors and ceiling section 4.6.2 in the book Introduction to Algorithms It had the following statement: Using the inequality $\lceil x \rceil \le x+1$ But I haven't seen the inequality anywhere and could not understand the verifiability of inequality. Instead the Chapte...
What are some applications where irreducible control flow is required*? I'm particularly interested in programming language features that will be tricky to efficiently compile if the compile target does not permit irreducible control flow. For example, a programming language offering GOTO will generate irreducible cont...
Assume in the applied pi-calculus we have the following process: $$(\nu n)\overline{c} \langle n \rangle.0 | (\nu n) (c(y).(\text{if n=y then P else Q}))$$ where $P$ and $Q$ are further processes. I know that the following reduction semantic holds for the applied $\pi$-calculus (from wikipedia): $$\overline{x}\langle z...
I was looking online, on sipser book, and on lecture notes and I can't find a proof to closure of context free languages to homomorphism that using PDA instead of CFG. I'm not looking for a full and formal proof, I just want to understand the general idea.
A Dyck path is a finite list of $1$'s and $-1$'s whose partial sums are nonnegative and whose total sum is $0$. For example, [1, 1, -1, -1] is a Dyck path. Rather than use $1$ and $-1$, it is common to use "U" and "D" for $1$ and $-1$, respectively, so we might write UUDD instead. (These might be more familiar as Dyck ...
The simple (naive?) answer would be O(n) where n is the length of the shorter string. Because in the worst case you must compare every pair of characters. So far so good. I think we can all agree that checking equality of two equal length strings requires O(n) runtime. However many (most?) languages (I'm using Python 3...
Let's assume I have a list of some words found in the English dictionary: ["hat", "assume", "prepare", "cat", "ball", "brave", "help" .... ] I want to sort these words (which are n in number) in a way, such that they are ordered based on their length, but if 2 words have the same length, they are ordered alphabetically...
Are there competitions for integer programming like there are for SAT and MAXSAT?
I'm working on the problem: Count smaller elements on right side using Set in C++ STL The solution is to add each element to the set and then to count the elements on the left, the distance function is called. This is the algo: 1. Traverse the array element from i=len-1 to 0 and insert every element in a set. 2. Find t...
First Look at the definition of SUBEXP from Complexity Zoo: SUBEXP: (Deterministic Subexponential-Time) The intersection of DTIME($2^{n^\epsilon}$) over all $\epsilon$>0. (Note that the algorithm used may vary with $\epsilon$.) or it can be written as: SUBEXP = $\bigcap_{\epsilon>0}$DTIME$(2^{n^\epsilon})$. So, I bri...
Please excuse or improve the poor title of this question. My question is rather undirected, but I guess I am trying to find out if I might be missing a keyword for my problem. So there is plenty of work on sorting algorithms. Sorting is usually understood as creating a / the one correct total order given a set of eleme...
$S \to aAA$ $A \to aS \mid bS \mid a$ Trivial thing: starting and ending with a Atleast 3 a's are definitely present (These are very layman observations...but seriously I am unable to figure out what exactly this language is all about. ...) My attempt: What I am able to generate 1)aaa 2)aAA a bS A a ba AA A a ba *** Th...
Consider the following python code X = [None] X[0] = X This has many fun properties such as X[0] == X and X[0][0][0][0][0][0][0][0] == X I understand how this works from a practical standpoint, as it's all just the same pointer. Now, when flattening a list, we tend to convert things from [[1, 2, 3], [[4, 5], [6, 7]]...
I have some difficulties with understanding the space complexity of the following algorithm. I've solved this problem subsets on leetcode. I understand why solutions' space complexity would be O(N * 2^N), where N - the length of the initial vector. In all those cases all the subsets (vectors) are passed by value, so we...
Consider these equivalent functions in C and Python 3. Most devs would immediately claim both are $O(1)$. def is_equal(a: int, b: int) -> bool: return a == b int is_equal(int a, int b) { return a == b; } But consider what is happening under the surface. Integers are just binary strings and, to determine equality,...
Say you have an array of integers like [1, 2, 3, 4, 5, 6], the problem is to find the smallest way to break up the array into sub-arrays where each sub-array satisfies the following requirement: sub-array.first_integer and sub-array.last_integer must have a common divisor that is not 1. So for [7, 2, 3, 4, 5, 6] the ...
Are there variations of the classic graph coloring problem that the number of neighbors in the same color is limited but not zero (in the original problem the limit is zero)? Problem: Given a graph $G$ and two integers $c$ and $p$, is it possible to color the vertices of $G$ with $c$ colors such that for every vertex $...
This is an exam question. For E = {a,b}. let us consider the regular language $L= \{x|x = a^{2+3k} or x=b^{10+12k}, k >= 0\}$ Which one of the following can be a pumping length (the constant guaranteed by the pumping lemma) for L? A)3 B)9 C)5 D)24 Ans is 24. As per me pumping length is the length which gets actually re...
Continuing from this question: the buckets of water problem. (All the definitions can be found there, so I will not repeat them). As seen there by Yuval's answer, the problem is NP-Hard. I was attempting to prove its NP-completeness, and while doing so - I was suddenly not sure whether or not it belongs to NP. Because ...
I try to find the solution to this problem: How do you find all integers in a sorted array of size n that appear n/k times in less than O(klogn) time? I could only find this question, where O(klogn) solution was provided.
A configuration of a Turing machine $M$ which runs in space $S(n)$ contains the state, the head positions, and the content of non-blank cells of all the tapes. For $M$ and an input $x$, we define its configuration graph $G_{M,x}$ as a directed graph whose nodes correspond to all the possible configurations and there is...
Suppose we have an interval of integers [a, b]. I would like to have a function that returns random members from within the interval, without repetitions. Once that all members within the interval are explored, the function would start to return the same first random sequence again, in the same order. Example: a=1, b=5...
We know that the number of permutations possible for $n$ unique items is $n!$. We can uniquely label each permutation with a number from $0$ to $(n!-1)$. Suppose if $n=4$, the possible permutations with their labels are, 0: 1234 1: 1243 2: 1324 3: 1342 4: 1432 5: 1423 6: 2134 7: 2143 8: 2314 9: 2341 10: 2431 ...
True or false: To show that a language L is not context-free, one can alternatively show that the union between L and a known context-free language is not context-free. I know that you can prove closure under context-free languages using union, but does the above work, too? Any help you can provide would be greatly app...
It's impossible for a problem to require exponential space without being exponential-time. Consider that if an $EXPSPACE~~complete$ problem can be solved in $2^n$ time. It will now fall into the class $EXPTIME$. Then $EXPSPACE~~complete$ problems are in $EXP$ if they can be solved in $2^n$ time. This means they can re...
Given any problem $P$ that we know of being in $NP-\text{complete}$, where is the flaw in the following proof? Given a problem $Co-P$ which is the co-problem of $P \in NP-\text{complete}$, $Co-P$ is at least in $NP$ because the following algorithm can always be given: Co-P(J): bool res = P(J) return !res Where...
I have heard many times that Group Theory is highly important in Computer Science, but does it have any use other than cryptography? I tend to believe that it does have many other usages, but cannot find out where and how to apply Group Theory to other areas in CS, such as algorithms, data structres, graphs, complexity...
I want to remove indirect left recursion from these rules: S-->TU, T-->US|b, U-->ST|a I don't know if I can implement the algorithm correctly. My assumption is to make it like this: S-->TU, T-->U'b, U'b-->U'a Is this correct?
Given a diagram of a room with obstacles in it (like walls or furniture), find the 4 best places to put omnidirectional light sources in it so the area that is lighted is maximized. Here is a simple example diagram so the problem can be better understood: The solution I thought was to find the spot with most light and...
I was making exercices about the Pumping Lemma for CFL, and I stumbled up on this language: $$ \{ 0^{i} 1^{j} 0^{k} 1^{l} \hspace{0.2cm}| \hspace{0.2cm} i = l \hspace{0.2cm} \land j = k \} $$ I quickly made a CFG that represents that language (or so I believe): $$ S \to 0S1 \hspace{0.2cm} | \hspace{0.2cm} A \\ A \t...
I have a core SMT solver problem consisting of 100,000 bit-vector array clauses, and one 10000-dimensional bit-vector array. Then, my program takes as input k << 100,000 new clauses, and adds them to the core SMT problem. My goal is, for any input of k clauses, to solve the entire problem. Is there any static optimiz...
We have $ M = (Q,Σ,Γ,δ,q_0,q_a,q_r) $ and $ M′= (Q′, Σ , Γ′, δ′,q_0′,q_a′,q_r′)$. We want to construct a standard Tm that recognize L(M) ∩ L(M′). How do I go about it? I don't have much more information than this. Anything to get started would be appreciated.
I have an array a of n entries. I need to place a token on the first and last position of that array, so a[0] = 1 and a[n-1] = 1. I now want to place additional tokens into that array with a distance inbetween each index i where a[i] = 1 that is greater than 2 (so placing a token on every index is invalid as well as al...
Suppose you have $n$ nonequal sets $S_1, \ldots, S_n$ and some constant $0 \le k < n$. The goal of set clustering is to find a partition of the set $\mathbf{S} = \{S_1, \ldots, S_n\}$ such that the sum of the total distance for each subset of $\mathbf{S}$ is minimized and such that $\mathrm{cardinality}(\mathbf{S}) = k...
After instruction has been fetched, does it go to control unit and register file at the same time or one after the other? For example if the control unit and register read both have 80ps delay, and we're calculating the total delay for a cycle, would we take their delay as 80ps(if they occur simultaneously) or if they ...
My task asks me to check whether there is a common element in two sets $\{x_1,x_2,...,x_n\}$, $\{y_1,y_2,...,y_n\}$ with $x_i,y_i\in\mathbb{N}$ using the Fast Fourier Transform (FFT). (I'm aware that there is a simple $O(n\log(n))$ algorithm to solve this problem using sorting and binary search.) The tasks hints that w...
I was reading a book which describes a historical perspective: Pentium 4E (2004, 125 M transistors). Added hyperthreading, a method to run two programs simultaneously on a single processor, as well as EM64T, Intel’s implementation of a 64-bit extension to IA32 developed by Advanced Micro Devices (AMD), which we refer ...
From the notes: It is not difficult to observe that the suffix array $\texttt{SA}$ of the text $\texttt{T}$ can be obtained from its suffix tree $\texttt{ST}$ by performing an in-order visit: each time a leaf is encountered, the suffix-index stored in this leaf is written into the suffix array $\texttt{SA}$; each time...
The present state Q2,Q1,Q0 of the counter before applying the clock pulse was (101). If the input Clock frequency to the circuit is 100KHz, then the output frequency of the circuit will be ? My Approach: I have built the state table and I concluded that from 101 it goes to 010 and from 010 to 101 again so it acts like...
Given the runtime of an algorithm to be m!/(n!*(m-n)!) That is mCn, where both m and n are variables, is the complexity factorial or polynomial? Or is it something else? Please elaborate. Thanks
Given an infinite decidable language $L$, then if $S \subset L$ such that $L \setminus S$ is finite, then $S$ must be decidable. This is true since given a decider of $L$ we contruct a decider for $S$: Simulate the decider of $L$ on the input, if it accepts, go over $L \setminus S$ and check if it is there, if it is, r...
Consider the following grammar: S → bAb | bBa A → aS | CB B → b | Bc C → c | cC I have to provide the reasons as to why this grammar is not LL(1). So far all I can think of is that the grammar is not left factored given the productions: S → bAb | bBa But I am also wondering if the grammar is left recursive ...
In finite precision floating point arithmetic the associative property of addition is not satisfied. This is, it is not always the case that $$(a+b)+c=a+(b+c)$$ Even $a=(a+b)-b$ is not always true. To prove that $x+y<z$ is equivalent to $x<z-y$ with real numbers we can add $-y$ on both sides of $x+y<z$ to get $(x+y)-y<...
I have a set $M$, subsets $L_1,...,L_m$ and natural numbers $k,l\leq m$. The problem is: Are there $l$ unique indices $1\leq i_1,...,i_l\leq m$, such that $\hspace{5cm}\left|\bigcap_{j=1}^{l} L_{i_{j}}\right| \leq k$ Now my question is whether this problem is $NP$-complete or not. What irritates me is the two constra...
Given an array $a$, we have to find product of $a_{j}$-$a_{i}$ modulo $998244353$ over all $i$ and $j$ given $j>i$. For eg. Let the array be $1,2,3$ then my answer will be calculated as- $(2-1)$.$(3-1)$.$(3-2)$=$2$ As number of elements in the array could be large (upto $10^5$) I am looking for solution of order $nlog...
I do not understand the last sentence of the proof provided. It says that the fact that xz does not belong to L contradicts the hypothesis, but isn't it that xyz not belonging to L what we are trying to prove?
Nowadays, most introduction books, videos, and comments about theoretical computer science talk about Turing machines but don't discuss recursion theory anymore. These approaches are known to be equivalent. What is the reason behind this? Has recursion theory simply gone out of fashion or is there a fundamental/mathema...
I've been thinking about grammatical evolution problems and how the grammar influences the algorithm performance. It came to my mind the huge impact that the grammar that you're using has in the time that takes an algorithm to reach an optimum solution. The simplest example would be if your problem doesn't involve trig...
I am trying to imagine a way of encoding a BigInt into a bit stream, so that it is literally just a sequence of bits. Then upon decoding this bit stream, you would generate the standard BigInt sort of data structure (array of small integers with a sign). How could you encode the BigInt as a sequence of bits, and how wo...
I have the following regular expression: Of course I could think of a word like $w=a^{m+2}b^{m+2}c^{2m+3}$ and continue with the proof BUT I was just wondering, because $L$ is made up of a union of two expressions, is it valid to split $L$ into $ L_1=\{a^ib^jc^{2j-1} | i<=j \land i,j>0\}$ $L_2=\{a^ib^jc^{2j-1}| i>=2j-...