instruction
stringlengths
35
29.1k
The language is given by: $$L=\{a^nb^m|n<m\}$$ I have proven that the language is not regular using the pumping lemma but I need help with proving it through Myhill-Nerode Equivalence. Any help would be appreciated.
What sort of speedup can a Turing machine with more than one head give vs a one-headed machine (I do not mean multiple tapes, I mean multiple heads operating on the same tape making concurrent edits on different parts of the tape)? ie. what is the overhead, worst-case, for a one-head Turing Machine to simulate a multi-...
Where $\Omega(f)$ denotes the set of functions with f as lower bound, why is $\sum_{i=0}^n\sqrt{i}\log_2^2i \geq \Omega(n\sqrt{n}\log_2n)$? How can the function on the left be compared to a whole set? I thought usually a function is an element of the set, i.e. $g\in\Omega(f)$ or it is not, i.e. $g\notin\Omega(f)$. If ...
The pipeline of a modern processor has many stages that may issue read requests to main memory, e.g. in fetching the next command or loading some memory location into a register. How is the result of a read request returned to the right pipeline stage, given that there are more than one possible recipients? Since most ...
I have arrays comprised of string elements like the following 2 examples. Each of the following lines is a string element of the array. example1: aaa bbb cc1 dd1 aaa bbb cc1 dd2 aaa bbb cc2 dd1 aaa bbb cc2 dd2 aaa bbb cc3 dd1 aaa bbb cc3 dd2 example2: bbb rrr nnn ttt ooo eee ddd fff contr bbb sss nnn ttt ppp ee...
There seem to be at least a couple different possible ways of modeling sum types in a type system, but I haven't been able to find consistent terms for referring to them: A sum type is formed from a set of "data constructors", which are function-like entities that notionally map values of a summand type to values of t...
Hi, I am learning about memory management in operating systems. I am confused with Address Translation. In this question (pic attached), can anyone explain, how the answer is obtained for Blank #2? What are the steps? Thanks in advance
I am trying to prove that the next problem is NPC: $$ A = \{ \langle\phi\rangle \ \big| \ \phi \ \text{is CNF and has sat. assignment where exactly 10 vars are TRUE} \} $$ I am trying to find polynomial mapping reduction from SAT but I can't find a way to force exactly 10 variables to get TRUE assignment. My idea was ...
I am wondering if there are any clustering applications in practice where the number of clusters, i.e., the $k$ in the $k$-means problem is very high ($k>50$, optimally $k>200$), if possible with a citation. The clustering can take place in any metric space.
Suppose you receive a list of $n$ instructions on $k$ boolean variables where each instruction has the form $$x_i \leftarrow x_i \oplus x_j,$$ (where $\oplus$ is the binary XOR) can we efficiently find a minimal series of instructions (of the same form) that computes the same result, using up to $m$ initially zero extr...
As per the title, is there any polynomial time algorithm to count the number of satisfying arguments for a 2SAT expression with pure literals? An even shallower case: Is there any such counter when the literals in the expression are either all positive, or all negative?
Consider there is a city with $n$ residents who are in need of internet and there are $m$ internet providers in the city. Here in the city every resident needs internet and every resident knows what providers are available to him. Formally let resident $i$ has list of providers $a_i$. Also each provider has a maximum n...
I know it should be easy but I'm trying to determine the complexity of the following variant of Subset Sum. Given a subset $S$ of positive integers and integers $k>0$ and $N>0$, is there a subset $T\subset S$ such that $|T|=k$ and the members of $T$ sum to $N$ ? All of the formulations of subset sum that I've seen do...
I'm trying to solve problem 5.33 from Sipser's Introduction to the Theory of Computation, "Consider the problem of determining whether a PDA accepts some string of the form $\{ww|w\in \{0,1\}^∗\}$. Use the computation history method to show that this problem is undecidable." I have an attempt at a solution but somehow ...
I need to find examples for language $L_i$ $i\in[1,3]$ of natural numbers that is: $L_1\in$ $RE \backslash R$ $L_2\in$ $coRE\backslash R$ $L_3\in$ $\overline{ R \cup RE}$ My idea was in any case to take a language in the desired language class, and find some sort of function from the language to the natural number...
How can we prove Stream A = νX. A × X is isomorphic to Nat -> A = (μX. 1 + X) -> A ? In programming sense, Stream A can be seen as a function from Nat to A, and I can write isomorphisms between them. But how can this be proven mathematically? I would also like to know the conversion mechanism from μ to ν, and vice vers...
By this I mean a theory where you can say Language X is Query Complete so that you know that language is able to do any sort of query? I'm guessing not because some queries would run into things that a language would have to be Turing complete to work? Why do I wonder - well you might have a relational database and a g...
I am having trouble recovering rotation and translation from an essential matrix. I am constructing this matrix using the following equation: \begin{equation} E = R \left[t\right]_x \end{equation} which is the equation listed on Wikipedia. With my calculated Essential matrix I am able to show the following relation hol...
I have a graph like this that starts from one top node and has cycles: I need to write an algorithm to figure if node1 depends on node2. The most primitive algorithm I've written simply starts with node1 and recursively follows all available edges looking for node2 starting from node1. It's very inefficient because I ...
This is a question from GATE CSE 2009. Which of the following is FALSE? A] There is a unique minimal DFA for every regular language. B] Every NFA can be converted to an equivalent PDA. C] Complement of every context-free language is recursive. D] Every non-deterministic PDA can be converted to an equivalent determ...
I did a project in a class using A* search to solve an 8-puzzle. But what about a puzzle with multiple ‘solved’ states? For example, and 8 puzzle with some repeated tiles. I’m not sure whether something like A* search could still work or not. I have trouble fathoming how a heuristic might be designed. Are their other s...
GJ Woeginger lists 116 invalid proofs of P vs. NP problem. Scott Aaronson published "Eight Signs A Claimed P≠NP Proof Is Wrong" to reduce hype each time someone attempts to settle P vs. NP. Some researchers even refuse to proof-read papers settling the "P versus NP" question. I have 3 related questions: Why are people...
If I have datapoints in a high dimensional space and want to find a (linear) subspace onto which a data-set projects well, I can use PCA and then discard less important dimensions of the new basis to get compressed datapoints. However, often the data can be projected onto lower dimensional spaces with much smaller erro...
Consider a Turing Machine which (1) reads all its input and (2) accepts inputs arbitrarily large. Can we conclude that there must be a loop in the finite-state control as its inputs get larger?
I was watching a dynamic programming video by Erik Demaine . He says here https://youtu.be/OQ5jsbhAv_M?t=2133 , finding the shortest paths from S to V for all V, by guessing the node after the starting node is not the right approach, and instead should guess the node before the last node. I didn't understand his explan...
A] {ambncpdq | m+p = n+q, where m, n, p, q >=0} B] {ambncpdq | m = n and p = q, where m, n, p, q >=0} C] {ambncpdq | m = n = p and p not= q, where m, n, p, q >=0} D] {ambncpdq | mn = p+q, where m, n, p, q >=0} Instead of Formal proofs if any answer can provide telltale signs of a language being CFL or not will be mor...
$$\log n+\log \frac{n}{2}+\log\frac{n}{4}+\log\frac{n}{8}+\cdots+\log\frac{n}{n}=\Theta (\log^2n).$$ The sum of logarithms is the logarithm of the product $n\cdot\frac{n}{2}\cdot\frac{n}{4}\cdot\frac{n}{8}\cdots\frac{n}{n}$. This equals $n^{\log n}$ divided by what? If the product would just be $n^{\log n}$, then this ...
Let's say we have a SUBSET-SUM problem with list {$x_1,x_2,x_3,...x_N$} and weight $W$, with some of $x_i<0$. Is there a known way, in polynomial time, to convert this problem into an equivalent problem, but with all $x_i \geq 0$? And if there aren't any, is it possible for there to be such an algorithm?
I am given a directed acyclic graph $G = (V,E)$, which can be assumed to be topologically ordered (if needed). Each edge $e$ in G has two types of costs - a nominal cost $w(e)$ and a spiked cost $p(e)$. I am also given two nodes in $G$, node $s$ and node $t$. The goal is to find a path from $s$ to $t$ that minimizes th...
When downloading a file from the internet to our computer we are usually prompted with an estimate of how long it will take for the file to be downloaded. From the Halting Problem, we know that $\mathrm{HALT}_{\mathrm{TM}}$ is undecidable, where: $\mathrm{HALT}_{\mathrm{TM}} =\{⟨M,w⟩\mid M \text{ is a TM and }M\text{ h...
(1) Assume a function $f:\mathbb{Z^+}\rightarrow\mathbb{R}$ that's defined in a way that utilizes, say, eight basic computations, including addition, subtraction, division, multiplication, (positive square) root, and the floor function. We write a (Sage) program that involves a "for-loop" execution for $f(x)$ values ra...
It is a joke with the title of a book I am reading: "But how do it Know? - The Basic Principles of Computers to Anyone". The author is explaining a basic unit of memory with NAND gates: I think I get the idea behind this component. 's' is what determines when memory is set, and 'i' is what gets "stored". So if it star...
I would like to find a prove of (a) so that the two E are acyclic and disjoint union and I dont unterstand b Could someone shed light on this problem, preferably spiced with some intuition? Thanks, DarkDragon.
All NP problems can be reduced to NP-Complete problems, can an NP-Complete problem be reduced to a NP problem (non complete)?
There are a couple of function pairs which give the identity when composed, e.g., decrypt(encrypt(value)) == value deserialize(serialize(data, filepath)) == data What is this property called? Suppose one function undoes the property of the other, and it is guaranteed that this is possible for all values (within the d...
Consider main memory of the size 64 kB with each word being 8 bits(one byte) only and a direct mapping Cache memory of size 4 kB also having data word size 8 bits. Find the following : Find the size of tag and index fields of cache? In what location of cache hexadecimal address to main memory (AABB) (if exists i...
I have n nodes, and I want to find the (non duplicate) number of possible ways in which these nodes can be combined in series and parallel, and also enumerate all the solutions. For example, for n=3, there are 19 possible combinations. 0 (0, 1, 2) 1 (0, 2, 1) 2 (1, 2, 0) 3 (1, 0, 2) 4 (2, 0, 1) 5 (2, 1, 0) 6 [0,...
Is there a way to estimate the number of unique monthly visitors to a site based on a limited sample of one week of data? I have information about when a given user visited the site. This isn't as simple as just multiplying the number of unique visitors the first week by 4, due to the hotel problem. If 10 people visit ...
I am considering implementing my own version of Bresenham's line drawing algorithm, found here, my one question is does the algorithm guarantee that both endpoints will be covered/drawn. I am doubting this because of the error accumulation factor (decision variable), but I may be wrong.
Every so often I'll hop on my laptop, open google, and eventually try to download and open some document, only for the document to wind up looking like this: What on earth does all this mean? What language is it, and why does it pop up instead of normally formatted English? Also, if it isn't already obvious, I have ze...
I am having some confusion between address bus size, physical address size and word size however (I do understand that unit of memory access is word and when word size is one byte then it's known as byte-addressable).
Consider the following algorithm: given a graph $G$ with $n$ vertices, set up a linear programming problem LP where there is a variable $x_i$ for each vertex $v_i$ of $G$, each variable can take value $\geq 0$, for each edge $v_av_b$ of $G$ set the constraint $x_a+x_b\geq 1$. The objective function is $\min\sum\limits_...
I was working to derive the Z-Combinator by starting with the factorial function and ended up deriving a different fixed-point combinator. What did I derive? Did I make a subtle mistake? Here are the steps I performed (in JavaScript) 1. Declare factorial function let fact = n => n < 2 ? 1 : n * fact(n - 1) 2. Conv...
Everything needed to know is in the question statement. I believe that the DFA has to be acyclic (meaning its language is finite), which can be checked in polynomial time. However, finding all paths from the start state to an accept state can run in exponential time in worst-case.
Consider the following problem: we want to implement ADT SpecialContainer which stores integer numbers and is similar to a PriorityQueue. This container should support the following operations: init(sc, n) - create a new, empty SpecialContainer sc. n is a positive integer number (will be used later) - $\Theta(1)$ tot...
I'm currently reading the CLRS Linear Programming chapter and there is something i don't understand. The goal is to prove that given a basic set of variables, the associated slack form is unique They first prove a lemma : And then they prove the result : My concern is that to prove the second lemma, they apply the fi...
I have a scatter of 2D elements on a 2D plane. I would like an efficient algorithm to prepare and query the number of points in a quarter plane (inclusive of boundary). The quarter plane is defined by a point $(x,y)$. All elements $(x', y')$ where $x<=x'$ and $y<=y'$ are in the quarter plane. For example I have elemen...
For a list of n 2d points, finding the convex hull vertex takes O(n log(n)) time. And O(n) time if it’s sorted lexicon order. Meanwhile What’s the complexity of finding the histogram bin edges of k bins on both axis ? E.g.: $$ X= ((x_0, a_0), (x_1, a_1), \cdots, (x_n, a_n)), x_i \in \mathbf{R}, a_i \in \mathbf{R} $$ Fi...
I have tried to search the internet to check if the following is correct: If $\sum_{2}$ contains a NP-Complete problem then PH collapses to NP: $PH=NP$ For example if $SAT\epsilon\sum_{2}$ than: $PH=NP$
My solution: let m = lg n. Then n = 2^m. T(2^m) = T(2^(m/2)) + theta(lgm). Let S(m) = T(2^m). Then S(m) = S(m/2) + theta(lgm). Applying master theorem, I get m^(lg1) = 1 which is asymptotically smaller than theta(lgm). So I think case 3 of the master theorem should apply. However, the solution given explains that case...
What is the difference between DeepFake and First Order Motion? Is it the same or not?
Show that the language consisting of all Turing machines whose language consists of strings that can be broken up into two consecutive and equal strings is undecidable. I would prefer if reduction was used and not Rice's theorem.
One property of the Big-O-notation is the sum rule, which states that when I have two functions $f_1$ and $f_2$ and their corresponding complexity functions are $g_1$ and $g_2$, then the combined complexity is $f_1 + f_2 = O(\max(g_1, g_2))$. But what do we pick if both complexity-functions are equal? E.g., if $f_1(n)$...
Let $\mathbb{Z}_2^n$ be the field of bitvectors of length $n$ and define the xor operator $\oplus$ and the addition operator $+$ over this field, with $+$ having the usual overflow semantics (take addition modulo $2^n$). Is it possible to express any mapping $f: \mathbb{Z}_2^n \rightarrow \mathbb{Z}_2^n$ entirely in te...
I am trying to understand this example of converting PDA to CFG but I am not getting the idea quite right. I do have the general understanding of theorem that if $p,q\ \epsilon\ Q $ and $X \varepsilon\ \Gamma$ for $[pXq]$ we have include the sequence of derivations which would pop X from the stack. I partially underst...
What does this expression mean? Normal distribution with condition I am reading a research paper and found the following expression (Eq.28 in the paper below). It means a Gaussian distribution, but the mean component seems conditional probability-like expression $\it{\bf{s}}_t | \it{\bf{m}}_{b, t, m}^{(j)}$. I have ne...
So the wikipedia page gives the following linear programs for max-flow, and the dual program : While it is quite straight forward to see that the max-flow linear program indeed computes a maximum flow (every feasable solution is a flow, and every flow is a feasable solution), i couldn't find convincing proof that the ...
I'm wondering if there is a mathematical or computer science term for a number X such that Y | X = Y? For example: 66536 | 1000 == 66536 In this case, 1000 is the "insert name here" of 66536. Perhaps there is no name for this..? I've tried searching for "bitwise OR returns itself" and other such terms but without luck...
Urzyczyn: Inhabitation in Typed Lambda-Calculi (A syntactic approach) gives a proof that STLC inhabitation problem is in PSPACE (section 2, lemma 1). I don't understand certain aspects of the proof: Lemma: There is an alternating polynomial time algorithm to determine whether a given type A is inhabited in a given bas...
My question is actually a request for papers, articles, texts or books on the problem that I'm trying to solve on my work. I'm working on a program that computes a predicate value (true or false) for a given object in a distributed system in which there is a stream of events that can change the object's attributes and,...
Is there an efficient algorithm to count how many ways there are to decompose a given finite simple undirected connected graph $G = (V, E)$ into the union of two trees $T_1 = (V_1, E_1)$ and $T_2 = (V_2, E_2)$ that are not necessarily edge-disjoint? By union I mean $V = V_1 \cup V_2$ and $E = E_1 \cup E_2$. My initial ...
Imagine there is an area on which you have to put radio towers. Each radio tower sends signal to a circular area of fixed size. How do I determine the optimal number and placements of these towers so the overlapping areas are as small as possible, the whole area is in range of towers, and the number of towers is minima...
I have an algorithm that generates a list of intervals. The algorithm is run m times. Lets mark the intervals as tuples (s1, e1), (s2, e2), .., (sn, en). It is possible to add the run ID to the tuple (though I don't think it helps). The goal is to "clean" spurious ranges (appearing in few runs) and to find groups of at...
Let's say I have a string 0110 and after 011 I reach an accept state (let's call the accept state "q") in an NFA. However, there is no transition mentioned in the diagram from q for the symbol 0. Does this mean the computation dies, or does this mean that the string is accepted?
I was going through the $\text{DFS}$ section of the Introduction to Algorithms by Cormen et. al. and I faced difficulty in understanding the $\Leftarrow$ direction of the proof of the white path theorem. Now the theorem which is the subject of this question depends on two other theorems so I present the dependence befo...
I am an electrical engineer and trying to make a transition into machine learning. I read in multiple articles that I have to learn data structures and algorithms, before this I have to learn about mathematical proofs. I started studying it on my own using the material available on MIT's OCW, while I did grasp the co...
I've come up with a problem which we'll call the Trader's Route Problem (If it's an already understood problem that would be great as well, let me know). Say there exist N cities, with some arbitrary distance d between each city (not all need be the same distance), and as a trader, you want to make the most money poss...
Say I have some data which represents a single line, and I want to determine its approximate slope. This data has a known minimum and maximum on the y-axis. When the line crosses the maximum, it re-emerges at the minimum, or vice versa, so there appear to be many parallel lines in the data. Clearly, the feasibility of ...
What would be a good pseudo code or Python 3 code for the following permutations problem? Let us define a n-permutation as a bijective function $\pi: \{0,...,n-1\}\rightarrow \{0,...,n-1\} $ and represent it using a list, meaning that $\pi(i)=j $ iff list[i]=j. Let us also define a pair permutation as a permutation in ...
The space complexity of the code snippet given below: int *a = malloc(n * sizeof(int)); int sum=0; for (i = 0; i < n; i++) { scanf("%d", &a[i]); for (j = 0; j < n; j++) { int x = a[i]; sum = sum + x; } } free(a); This is question of a test. I answered it $O(n)$, considering space only f...
I am having trouble with coming up for a suitable algorithm for this question. A max-heap is essentially visualized as a binary tree not a binary search tree. Also the runtime of the algorithm must depend only on the number of elements in the output. I was thinking of doing a preorder traversal on the max heap. While d...
I was asked this question in a phone interview recently and I bombed it completely. Zero clue how to approach it. I wasn't able to find any similar patterns on google-ing. Thought maybe folks here might be able to help? Statement: Given m sticks with different lengths. Combine these sticks to form longer sticks with t...
How can you prove that any DFA accepting the language generated by the regular expression $\{0|1\}^*0\{0|1\}^n$ requires at least $2^{n+1}$ states? I first attempted induction on $n$. But I don't even see how to prove the base-case, like if $n=1$. You need the DFA to take any string and, when it encounters a 0, get s...
Assume we have a C-like programming language with no pointer/heap semantics (i.e. there is no concept of memory; everything is on the stack). The only datatype supported is Integer, but suppose the Integer is infinitely large (i.e. without 32-bit, 64-bit, or any size limit). Is it true that this language is Turing-inco...
It is known that there does not exist a regular graph of order $n$ with clique size greater than $\lceil\frac{n}{2}\rceil$. My question pertains to Cayley graphs with large degree, say $\ge \frac{n}{2}$ and not complete. I think the maximum chromatic number is $\lceil\frac{3n}{5}\rceil$. As an example of a graph attain...
Here's the question The content of PC in the basic computer architecture (given below) is 3AF. The content of AC is 7EC3. The content of memory at address 3AF is A32E. The content of memory at address 32E is 09AC. The content of memory at 9AC is 8B9F. The next two contents of PC are 3B0 and 3B1. The content of memory ...
One of the specifications of sort algorithms is stability, which means items with the same value in different indices are not replaced after applying sort algorithm. Why selection sort is unstable and can we make a sort algorithm stable by changing its swap condition?
Given a non-deterministic top-down tree-automata. is there an algorithm, that can determine if there exists any tree that accepted by this automaton? if so, what is the most efficient algorithm known? Thanks.
Given the definition of 'record': "a collection of field values for a given entity", is this a set of field values for ALL the fields of the entity, or only one particular field [so that you get a different set for each field]? Also, is the relationship b/w a field & field value essentially equivalent to a function? NO...
I am new to operating systems and have been wondering about this. Consider a normal text editor, and it's process running in the CPU. Since text editors include IO operations, do the process keep switching it's state from Wait -> Run -> Wait etc. While the user is typing and the same is reflected on the screen or some ...
Given a graph $G(V, E)$, consider the following algorithm: Let $d$ be the minimum vertex degree of the graph (ignore vertices with degree 0, so that $d\geq 1$) Let $v$ be one of the vertices with degree equal to $d$ Remove all vertices adjacent to $v$ and add them to the proposed vertex cover Repeat from step 1. until...
I was going through the edge classification section by $\text{DFS}$ algorithm on an undirected graph from the text Introduction to Algorithms by Cormen et. al. where I came across the following proof. I was having a little difficulty in understanding the steps of the proof and hence I made an attempt to understand it f...
I'm trying to implement my own version of a deep neural network with differential privacy to preserve the privacy of the parties involved in the training dataset. I'm using the method by Abadi et al. proposed in their seminal paper Deep Learning with Differential Privacy as the basis of my implementation. Now I have tr...
My task is to solve the 2SAT problem. I have read online that a good method to solve this problem would be to construct an implication graph, where each statement of the form A || B implies two edges ~A -> B and ~B -> A. Then, we can set values to each variable by finding all the strongly connected components of the gr...
Given a Turing machine M on alphabet {m,e,b,r} we're asked to determine if member $\in$ L(M). You must realize that M is not one specific machine and can be any turing Machine with the same alphabet. My goal is to determine whenever this problem is decidable or not. My idea was to use mapping reducibility. The goal was...
I have a basic understanding of the Fourier Transform, though I'm trying to use it in a program and I'm confused on the specifics. Based on source code I can find online, the DFT takes a set of samples/numbers, performs a summation for each term, and returns a set of these summations which is the same size as the input...
How can I take a Haskell data type or function (eg fold, list, String, zip) and convert or translate it to a lambda calculus abstraction? Example: If sum computes a sum of all elements in a list, and :type sum = Num a => [a] -> a. sum [] = 0 sum (x:xs) = x + sum xs How do I take this information to transla...
(Motivated by this question. Also I suspect that my question is a bit too broad) We know $\Omega(n \log n)$ lower bound for sorting: we can build a decision tree where each inner node is a comparison and each leaf is a permutation. Since there are $n!$ leaves, the minimum tree height is $\Omega(\log (n!)) = \Omega (n \...
We are currently working on a variant of domination parameter and we have shown that it is in W[3] with regard to parameterized complexity. To show it is W[3]-complete, we must show the problem is W[3] hard i.e, reduce an already known W[3] hard problem to ours. But unlike W[1] and W[2], where many famous problems are ...
Please assume for the sake of this session that humans can fluently read and understand machine languages and time isn't a problem in that regard. I, not a computer scientist, would at least theorize that a unary machine language is possible but might just be much "less comfortable" than binary machine language. Is una...
Define $\{\sigma(n,k,m,i)\}_{i=1}^{l_m}$ an ordered set of all TMs with $n$ states and $k$ symbols that halt after $m$ steps on $\epsilon$ There are $(2kn)^{kn}$ TMs with $n$ states and $k$ symbols, so $l_m$ is always finite and so is the range of $m$. If we could iterate over $\sigma$ given $n,k$ for all $m,i$, then w...
I noticed that FM-indexing is a preferred way to match strings in large data sets, and in particular DNA sequencing wiki-article. I know that with this method, it can eliminate space dependencies thanks to compression methods. However, alternatives like Knuth-Morris-Pratt Algorithm or Rabin-karp are highly effective in...
Disclaimer: I'm not a compiler expert. I'm simply curious and come seeking enlightenment. I've seen people claim that -- for efficiency -- for loops should generally use a zero comparison for termination. So rather than: void blink1(int n) { for (int i=0; i<n; i++) { blink_led(); } } you should write...
I have the following messy chart; As you can see some features are very stable through the time series (post-2011) like Extraversion. Is there an algorithm to remove features that do not have much variation compared to the other features?
I'm already know that there is an algorithm that can solve A[i]=i in O(log(n)) in a sorted array. But I want to know if there is any kind of algorithm that also can solve A[i] = C1 * i + C2 (witch C1 and C2 are constant values) in O(log(n)) or not
It is easy to show that there exists a grammar that can be parsed by a recursive-descent parser with backtracking but is not an $\text{LL}(k)$ grammar (consider any grammar with a production featuring two alternatives starting with $k$ occurrences of the same terminal). My question is the following: Is there an identif...
Description Suppose we have a string containing letters 'A', 'B', 'C', 'D', and the characters are placed in a stack. We also have an empty stack. Ultimately, we want all of the same letters to be together (continuous order) in the 2nd stack, using only 3 operations: push("p"): Removes an items from the bottom of the...
Assuming I have firewall set to block an application from accessing the Internet, would I DNS request go through? I tried using C (gethostbyname) on Windows and the answer is no. It seems that the application sends the DNS request to the public DNS server, but I wonder if this is the same under Linux. In particular, co...
The unicode characters under the "Basic Latin" unicode block from U+0020 to U+007F are the characters that characters we use in English. However, the "Latin-1 Supplement" block from U+00A0 to U+00FF is an extension of the "Basic Latin" block and includes characters that are used in some languages. For example, the Span...
$\{a^p; p$ is a prime number, $m$ is a fixed number and $m\geq p \geq 0 \}$ I know this is regular since it is finite, but I don't understand how to build an NFA for this if we do not know what $m$ is. Is there a way to draw the NFA regardless?