instruction
stringlengths
35
29.1k
Suppose I have two cameras, c1 and c2, observing the same scene. I can now Calibrate each camera independently (e.g., with MATLAB's Camera Calibration App) Calibrate both cameras simultaneously (e.g., with MATLAB's Stereo Camera Calibration App). Interestingly, the values calculated for the intrinsic parameters of bo...
Consider the following equation with variable $n \in \mathbb{N}$: $$\sum \limits_{i=1}^{k} \cos(n\theta_{i}) = 0.$$ Given $\theta_1,\dots,\theta_k$, I'd like to determine whether there exists $n \in \mathbb{N}$ such that the above equation holds. For $k = 1$ a solution can be directly found in $O(1)$ time by taking the...
The Bitcoin-solution can be described as "[...] a solution to the double-spending problem using a peer-to-peer network. (official Bitcoin paper, PDF, abstract, first page). Now I wonder if a similar technology can be used to collect, send and receive other data with the goal to create "unique content". That is data tha...
It is given two subsequences. Their length are following: $2$ and $5$. I can show that lower bound of comparisons is $5$. My problem is that I can't show that $5$ is sufficient number of comparisons to merge these subsequences. In order to show lower bound I use tree of comparisons (number of leaves is $21$, so height ...
I know that from this answer to a question on the class NPC, that NPC is not in general closed under intersection and union. However, the answer used languages which form trivial languages under these set operations and trivial languages are of course not NP-complete. If the intersection or union is non-trivial, does...
I understand that the Cook-Levin theorem proved that any NP problem is reducible to an NP-complete problem, which signifies that if a polynomial-time algorithm for an NP-complete problem is found, it will mean that all problems in NP can be solved in polynomial time. My question is: does this proof also hold the other ...
How to generate random graphs with eulerian Paths? Its well known that there is a eulerian path if the number of nodes with odd degree is exactly 2 or zero. I'm interested in an algorithm to make uniformly distributed random graphs with such paths. Until know I've developed this simple algorithm: Given the number of no...
Given - A center(lat=x,lng=y) 'C' from which a delivery boy makes a round trip. A delivery boy has a bag which may contain at the most 10 boxes to deliver. A set of points Di (lat=xi,lng=yi) around 'C' where the delivery has to be done. D=number of Di & 1<=D<=10 Each Di either belongs to time window(30 minutes) W...
I have this question in my homework. Its an a multiple choice question and goes as following: Let $f (x) = 3x^3 + 2x + 4$. One has that $O(x^3)$ ** the answers have been checked with the teachers note ** C and K are the constants $(C,K) = (10,0)$ $(C,K) = (6,1)$ $(C,K) = (9, 1)$ $(C,K) = (12,1)$ $(C,K) = (3,2)$ $(C,K...
I have an algorithm that depends on two input sizes n and m. The complexity breaks down to the following equation: $\frac{nm - 1}{n-1} = O(?)$ Is Big-O of the Formula $O(mn)$ or $O(m)$ because $n$ cancels out? Thank you in advance! PS: I know that if $O(m)$ is the upper bound $O(mn)$ is an upper bound too, I want to fi...
I am not able to solve time complexity analysis of this recurrence relation: T(n)=3T(n/2)+n^2.I want to find time complexity analysis of this recurrence relation without using masters theorem could you please help me to do so.
I am trying to construct a red black tree out of only black nodes. I know it is possible getting it after some deletions but I am trying to construct one only via insertion orders. Is it possible? I couldn't find a way to do so , so far even after trying to use the simulator. *** exept of a root node being added to an ...
How does IDA* compare to recursive best first search (RBFS), in terms of (a) the number of nodes expanded, and (b) space complexity? Both algorithms are intended to be memory-efficient heuristic search algorithms. From my understanding, RBFS just updates the $F(n)$ value for the parent node for which the current execu...
I've encountered scheduling problems in my algorithms class before like the type we use vertex cover to solve. Recently I was asked this question and did not even know what algorithmic technique to use to answer it! There are two trains, which run between stations and share a portion of track. For instance train 1 runs...
On this site http://algs4.cs.princeton.edu/25applications/ is described A* algothihm this way The A* algorithm is a problem-solving process where we put the start configuration on the priority queue, then do the following until reaching the goal: remove the highest-priority configuration and add to the queue al...
For regular languages we have $\omega$-regular languages which extend them to infinite words. Are there such extensions for CFG's, CSG's and recursively enumerable languages?
Is there a hardware interrupt that is pre-configured by the OS or something? Try to keep the answer on the scale of a register or so. Are some special preparatory signals sent across the bridges to the hardware to make boundaries?
I saw from this post on stackoverflow that there are some relatively fast algorithms for sieving an interval of numbers to see if there is a prime in that interval. However, does this mean that the overall decision problem of: (Does there exists a prime in an interval?) is in P. (There were a lot of answers to that p...
Say that we have a list of size $N$ to fill with elements of a dictionary of size $D$. So we would have in total $D^N$ elements/possibilities. It makes sense to me how to write an algorithm for this when the number of possible slots to fill $N$ is fixed. For example if $N = 2$: A %array of size (D x D x D) = D^3 for i1...
Suppose I have $n$ kinds of coins $c_1, c_2, \dots, c_n$. I'm given: $S$, an amount of money I should construct with minimum number of coins. I came into the following formula: $$ T(n,S) = \begin{cases} T(n-1,S) & \text{if $c_n > S$}, \\ \min(1+T(n,S-c_n), 1+T(n-1,S-c_n), T(n-1, S)) & \text{otherwise}. \end{cases} $$ ...
It is claimed in my textbook that In a 32-bit system, The instruction LDR r4,[r6] lets you address a logical space of 4GB. I know where the 4GB comes from, It is simply 2^32 / (1024 x 1024 x 1024). However, My question is why is it bytes and not bits ? Why when we raise 2^32, we should talk about bits and not byte...
I'm trying to write a regular expression over the alphabet $\{a, b\}$ for the language in which every $b$ is preceded and followed by an even number of $a$'s. I think the regular expression should include something like $((aa)^*b(aa)^*)^*$ but I don't know how to extend it in order to get to the correct form. Can anyon...
If $\mathsf{NP\subseteq BPP}$, then we know that $\mathsf{NP\subseteq RP}$ (http://www.csie.ntu.edu.tw/~lyuu/complexity/2011/20120103s.pdf). Does $\mathsf{NP\subseteq BPP}$ also imply $\mathsf{NP\subseteq coRP}$ and hence $\mathsf{NP\subseteq BPP}$ also imply $\mathsf{NP\subseteq ZPP}$?
I was doing some of the interrupts question online and found this Multiple choice question How can the processor ignore other interrupts when it is servicing one a) By turning off the interrupt request line b) By disabling the devices from sending the interrupts c) BY using edge-triggered request lines d) All of the ab...
I'm trying to measure now much non redundant (actual) information my file contains. Some call this the amount of entropy. Of course there is the standard p(x) log{p(x)}, but I think that Shannon was only considering it from the point of view of transmitting though a channel. Hence the formula requires a block size (s...
I'm actually working on high dimensional data (~50.000-100.000 features) and nearest neighbors search must be performed on it. I know that KD-Trees has poor performance as dimensions grows, and also I've read that in general, all space-partitioning data structures tends to perform exhaustive search with high dimensiona...
I want to survey the state-of-the-art in image segmentation. Is there a paper on how to segment multiple objects in an image? The segmentation papers I read, normally identify one of the many objects in the image. This object is typically in the center of the frame, or most-foreground compared to other objects in the i...
I'm looking for the name of a binary tree which is almost degenerate: at least one child of every interior node in the tree is a leaf. (Image from Penn State course STAT 557, Data Mining, lesson 10.)
Taking a look at Julia's webpage, you can see some benchmarks of several languages across several algorithms (timings shown below). How can a language with a compiler originally written in C, outperform C code? Figure: benchmark times relative to C (smaller is better, C performance = 1.0).
Whenever I read about equality I took it for granted, but few days ago I wondered if my understanding is not too shallow. Consider such example (taken from: http://david.tribble.com/text/honalee.html): Expr -> Expr '+' . Term Term -> '+' . Term Term -> . Factor Usually it is all about SLR(0) equality so in short,...
I took a typical computer architecture class a long time ago as an undergrad and since then I've done a fair amount of low-level systems programming down to the assembly level and worked on OS kernels. However, I still acknowledge that I have some gaps when it comes to understanding how memory subsystems work in multip...
I'm involved in a university course which is a crash course in the basics of problem solving and common concepts in computer science. The course contains a number of practical assignments and ends with a group project (~30 hours) in which at least two students solve a problem given to them. Lately we have focused on as...
I have a problem which goes like this. There is an $N$ x $N$ board in which some squares are maked with $x$. The upper left and lower right corner squares are also marked. You have a chess knight with which you want to go from the upper left to the lower right corner, using only marked squares. Find an effective algori...
The usual way of translating the maximum clique problem into a decision problem is to ask "does there exist a clique of size $\ge k$ in $G$?" Clearly this problem is in NP (and is NP-hard). Another possible way of making it into a decision problem would be: Instance: Graph $G=(V,E)$ and vertex $v\in V$. Question: Does...
Are there any methods, so that I can use a counting semaphore as a binary semaphore? A binary semaphore should have two possible states: 0 and 1. The operation wait() should atomically look at the state, if the state is > 0, the state should be decremented and the process should continue. If the state is 0, the proce...
When working on fast parallel multiplier circuit designs, like Wallace tree multipliers or Dada tree multipliers I found many papers and books refer to different components used in the tree to reduce the partial products called things like (4:2) compressor, or (7,3) counter or (7:3) compressor. My question is : "What ...
$F[u, u^{-1}]$ is a ring that contains the polynomials in $u$ and $u^{-1}$ with coefficients in the field $F$. Some theorems (from https://math.stackexchange.com/questions/1382120/ft-has-undecidable-positive-existential-theory-in-the-language-cdot) are the following: Theorem 1. Assume that the characteristic of $F$...
There is an enormous mass of source code in this world, and I think it's safe to say that most of this source code was once copied from elsewhere, then modified. There is a decent chance of the (small, incremental) modifications having been made traceable in some kind of version control repository, but the (larger-scal...
I'm trying to understand why an alternate formula for finding the best $p$ items in a 0/1 knapsack with $n$ items isn't working. The formula was proposed by @Carlos Linares López in this answer: Variant of the Knapsack Problem. Please read the previous answer for context; also I'm positive that the formula is still co...
Can anybody give me some hint on how to do this? I'm not really sure where to start. The problem says: We say that an array $A[1...n]$ is $k$-sorted if it can be divided into $k$ blocks, each of size $n/k$, such that the elements in each block are larger than the elements in earlier blocks, and smaller than the el...
Given a multiset of natural numbers X, consider the set of all possible sums: $$\textrm{sums}(X)= \left\{ \sum_{i \in A} i \,|\, A \subseteq X \right\}$$ For example, $\textrm{sums}(\left\{1,5\right\}) = \left\{0, 1, 5, 6\right\}$ while $\textrm{sums}(\left\{1,1\right\}) = \left\{0, 1, 2\right\}$. What is the most eff...
If a process could run as much cores as available, which CPU is faster, a 2-core 2.6GHz CPU or a 4-core 1.3GHz CPU?
This question is somewhat of a converse to a previous question on sets formed from set operations on NP-complete sets: If the set resulting from the union, intersection, or Cartesian product of two decidable sets $L_1$ and $L_2$ is NP-complete, is at least one of $L_1, L_2$ necessarily NP-hard? I know that they canno...
It is known that there are problems in P that, provably, are not solvable in less than $O(N^k)$, for some $k$. Now consider some infinite set $K \subseteq \mathbb{R}^+_0$ such as K is unbounded from above (you can think of $K$ as being $\mathbb{N}$, for easy reasoning). Theorem: If there exists at least one problem in ...
Let's say OS is using preemptive CPU scheduling. A process P1 gets a chance to run for some time and then next higher priority process comes and preempts P1. After that higher priority processes are coming regularly and P1 never gets chance. Is this condition called starvation or not?
I have problem with understanding why precondition strengthening is sound rule in Hoare logic. The rule is: $$ {P \implies Q, \{Q\} C \{X\} } \over {\{P\} C \{X\}} $$ I really do not understand why precondition in consequence goes in reverse direction that implication works (modus ponens). I can understand why post-con...
Basic question, but is only information/ data stored in ram? Are computer files such as a word file considered information/ data? This is one of the questions in a summer assignment for ap computer science.
I try to minimize the function $$ f(x_1, …x_n)=\sum\limits_{i}^n-a_i\cos(4(x_i-b_i)) +\sum\limits_{ij}^\text{edge}- \cos(4(x_i-x_j)), \quad x_i,b_i\in (-\pi, \pi)$$ where $\sum\limits_{ij}^{edge}$ only sums over predefined edges (the edges are sparse, typical there are 4 edges for each $i$). The variables $a_i, b_i$ a...
There are $n$ plates $p_1$ to $p_n$ each filled with money of value $a_1$ to $a_n$. You can take the money from one or more plates if the sum of the money in them is divisible by three. I need a $\mathcal{O} (n)$ asymptotic time logarithm for finding the maximum earnings that can be achieved. I have no idea for such a ...
Assume we are given $k$ bins of capacity $b$ and $n$ items with integral sizes $x_1,\dots,x_n$. The bin packing problem is to decide whether there exists an assignment of items to bins such that no bin exceeds its capacity. In this standard from, the bin packing problem is well known to be NP-hard. However, consider a ...
I am reading Concepts, Techniques, and Models of Computer Programming and came across Flow-based (FBP) and Reactive programming paradigms. Now I have found the following article from J. Paul Morrison, the person who invented FBP. I am also some what familiar with Reactive programming. But I am having hard time to diffe...
I'm looking at the paxos family of protocols for solving consensus in a network of unreliable processors. I'm working through scenarios where processors fail, and I know I'm wrong, but I don't know why. I have 3 machines with the state A. One machine goes down. The client requests a state change. Paxos works, and mach...
When attempting to find the following loop invariant for: int log(int x) { int i = 0; int j = x; while (j > 1) { j = j / 2; i = i + 1; } return i; } I come up with the following loop invariant: j >= 0 and i >= 0 must be true before, during and after each iteration. For case where x >= 0, upon check...
We have n cards with each card numbered from 1 to n. All cards are randomly shuffled but all cards are visible We are allowed only operation MoveCard(n) which moves the card with value n to the top of the pile. We need to sort the pile of cards with minimum number of MoveCard operations. The brute force approach which ...
I have a language, and I want to find a regular expression for the language. How do I do that? Is there a step-by-step, systematic procedure for that? Pretend I am just learning this topic; what approach can I use? If it helps, you can assume the language is given in English (e.g., something like "$L$ is the set of ...
Usually, when I program recurrent neural networks, I use a loop for each neuron to figure out it's state. What I realized with this is that in this case, no neuron gets any feedback. They just pump their outputs to the next neuron in the cycle. My thoughts on how to counter this is by having neurons in two different ti...
The problem gives a MST $T$ and a series of $Q$ queries, each one with a new edge $e = \{u,v\}$ such that no edge between $u$ and $v$ exists in $T$. For every query, we have to improve $T$ with $e$ and print the new weight of $T$. The best I can do is run a DFS ($O(|V|)$) to find the current path $P$ between $u$ and $v...
I am studying the Running Gaussian Average Method for background subtraction. One alternative, as described in Wikipedia, also known as Selective Background Updating, is to only update the distribution of background pixels. I have two questions on this topic: (1) To determine whether a pixel is foreground or backgroun...
I'm using K-means for unsupervised learning, using data vectors with an IP address and a language. I need to represent them in an abstract way, so that I can use this algorithm.
A simple fact is that $P = NP \to P = coNP$, which follows from the observation that $P$ is closed under complement. I am having trouble seeing that an analogous statement is true at higher levels of $PH$. For example, is it known that $NP = \Sigma_2 P$ implies $NP = \Pi_2 P$? If so, is there an easy proof? Would su...
Sun has been making a lot of noise about the Spark M7 and its inbuilt support for the java garbage collector. However there seem to be very little easy to find information about it. Please can someone explain what is so great about “Concurrent Fine-grain Memory Migration”? Does the M7 cpu have any other novel ways ...
I've wondered why the tape/tapes are not part of the formal definition of a Turing Machine. Consider, for example, the formal definition of a Turing machine on Wikipedia page. The definition, following Hopcroft and Ullman, includes: the finite set of states $Q$, the tape alphabet $\Gamma$, the blank symbol $b \in \Ga...
Suppose we have a regular language that describes every string with the exact length of 3.That is obviously a regular language and it still can't be pumped because there is no cyclic behavior in that string/ the corresponding dfa Can you please help me figure out my mistake?
Question: Is there established procedure or theory for generating code that efficiently applies a matrix-vector multiplication, when the matrix is dense and filled with only zeros and ones? Ideally, the optimized code would make systematic use of previously computed information to reduce duplicated work. In other words...
I'm performing a simple one dimensional walk to create sample interest rates. Whilst I know there are lots of options for encouraging values to oscillate around a mean etc. I'm yet to find a simple "proper" way to handle truly random processes going out of bounds. Whilst you could simply turn it in the other direction,...
I have two numbers x and y. The upper bits of x are stored at location m, while the lower bits of x are stored at location n. The upper bits of y are stored at location i, while the lower bits of y are stored at location j. I have the division operator "/" and the multiplication operator "*", but only for numbers store...
I am trying to verify that the NFA below does not accept babba. However, when I tried to do it by hand I must have made a mistake: $$\{q_1\}, \{q_2,q_3\}, \{q_1, q_2, q_3\}, \{q_2, q_3\}, \{q_3\}, \{q_1\} \rightarrow \text{Accept}$$ Where is my error?
I am working on a project where I have to build an in-memory distributed graph capturing the relation between similar files(based on some similarity metric) stored in shared file system over multiple nodes in a network. I know basic graph data structure. I googled to know about distributed graph, but what I found mostl...
I have a graph with the edges already assigned colors and there are edges of the same color as well as different colors incident to each vertex. I would like to find an edge cover (does not have to be minimal) such that no two different colored edges of the edge cover are incident to the same vertex. I thought about ...
I am having difficulties with understanding the concept of paging. As a result I've got no idea how I can solve the following exercise - I'm lacking one more equation to solve it. I've read a lot about paging and watched a few tutorials, but I still cannot solve paging problems easily. I'll provide some of the resource...
Question: Does the "size" of an algorithm typically refer to the number of its inputs, or its running time? This seems an ambiguous term to me that I keep seeing in textbooks.
I have a generator of files with approximately 7 bits /byte entropy. The files are about 30KB each in length. I'd like to use these as sources of entropy to generate random numbers. Theoretically I should be able to achieve about 26 KB (max) of randomness per file. This is a hobby and I know about hashes, but they're p...
In https://cs.stackexchange.com/a/45524/28999, they do a binary search using an oracle for an NP-Complete problem. They show that the original problem can be reduced to that NP-Complete problem, implying that the original problem is in NP. Why is that allowed? Why are you allowed to continue after the oracle returns fa...
It is well known that in practice, a substantial difference in run-time between algorithms for testing intersection of a line segment with aligned or oriented bounding boxes (in computer graphics parlance AABB/OBB) does exist. Nevertheless, I wonder if anybody has ever tried to find a lower bound on the run-time for a ...
Im not sure if I am understanding this question correctly. Its a problem without a solution in my text. Starting with 1, and at least 01 or at least 010 or both these substrings..... So a regular expression will be given by: $1(0+1)^*01010(0+1)^* + 1(0+1)^*01001(0+1)^* + 1(0+1)^*010(0+1)^* + 1(0+1)^*01(0+1)^* = M$ But...
I've read in an article that $coRP = RP$ is an open question, but that it is obvious that $coRP \subseteq RP^{RP}$. If $L \in coRP$, I don't understand how access to the oracle helps to build a probabilistic machine that proves $L \in RP^{RP}$. Any explanation would be appreciated.
Can anyone show me step by step how to do a proof on self referential structures. For example, this example is in scala lazy val y : Stream[Int] = 1 #:: (y map (_ + 1)) How do I prove that y is a stream of natural numbers. #:: is stream cons in scala. Also this example is from wikipedia fibs = 0 : 1 : zipWith (+) fi...
I've been struggling lately with a problem that was in my last complex algorithms exam, and I can't find a solution. The problem is as follows: Half-SAT is a problem where C is a CNF boolean formula with n variables and m clauses, where m is even. We have to determine if there exists an interpretation that satisfies e...
In the second chapter of Cormen's textbook on Algorithms, he lists a discrete mathematics exercise on so-called "inversions", defined as follows: Let $A[1 \ldots n]$ be an array of $n$ distinct numbers. If $i < j$ and $A[i] > A[j]$, then the pair $(i, j)$ is called an inversion of $A$. Question: Is this a mathematica...
Hello I am a layman trying to analyze game data from League of Legends, specifically looking at predicting the win rate for a given champion given an item build. Outline A player can own up to 6 items at the end of a game. They could have purchased these items in different orders or adjusted their inventory position du...
Here is Wikipedia's explanation of Horner's Method: Given the polynomial $$ p(x) = \sum_{i=0}^n a_i x^i = a_0 + a_1 x + a_2 x^2 + a_3 x^3 + \cdots + a_n x^n, $$ where $a_0, \ldots, a_n$ are real numbers, we wish to evaluate the polynomial at a specific value of $x$, say $x_0$. To accomplish this, we define a new seque...
Show how to augment dictionary of intervals (insert, delete, search) in order to make possible answer to following questions: Check if given interval $[a, b]$ intersects with some interval in a dictionary Check if given interval $[a, b]$ belongs to some interval $[c,d]$ in a dictionary (it means that $[a,b]\cap ...
Production systems have been used to solve puzzles such as the Tower of Hanoi for years with hard-coded production rules. However, has there been any research in using reinforcement learning to combine basic production rules into more complex ones with the goal of solving a puzzle? Note that I've asked a similar questi...
Let us assume the standard situation in communication complexity with two players $P_1,P_2.$ We have a function $f:[n] \times [n] \mapsto \{0,1\}$ that both players known in advance. They wish to compute $f(x,y)$ given that the first player only knows $y$ and the second player only knows $x.$ The communication complex...
The Arden's lemma states that there exists a solution to the equation between regular expressions r = sr + t, with r unknown, and it is s*t. I went through some other topics on the forum and I always saw it being applied, for example, on grammars that have productions like S->AS|b so that L(S) = L(A)L(S) + b and the so...
Given a set with $n$ items, find $x$ subsets, each one of them of size $y$, such that every two subsets share exactly one item. I've tried to solve it with a reduction to a graph, but I got lost... Thanks.
I have recently encountered the following problem which I heard can be solved by using BIT (binary indexed trees) but I am not sure how: Given an array $a[1, 2, \ldots, n]$ and $Q$ queries of the form $(L, R, i)$ $(L\leq i\leq R)$. For each query, you have to print the number of $j$ such that $L\leq j\leq R$ and $a[j] ...
I've been trying to figure out the answer for this question. How exactly a human brain understands or computes the meaning of any sentence after doing the lexical analysis and parsing? What is the science behind this? I've searched widely but couldn't read anything satisfactorily. I hope to get one here! Beside, It w...
The Sieve of Eratosthenes bothers me because you have to specify an upper bound before you begin the algorithm. Is there a prime sieve that doesn't require this? More Formally: Is it possible to write an iterator on which the i'th call to next() yields the prime number $p_i$ in only $O((p_i - p_{i-1})log(log(p_i)))$ ti...
Let's encode every state and tape word (with position of Turing machine on it) with a single integer. Then the transition function can be represented as a total function from integers to themselves. Now let's apply any known algorithm for searching a cycle in the chain of pointers to that function and we've got it! P.S...
Consider a database with the following properties: It stores symbols (represented as 64-bit integers) and sets of symbols Sets may contain thousands of symbols, and there may be thousands of sets which are the same except for one or two added symbols Every set should have exactly one canonical representation (two iden...
If compilers have an inheritance of compilers(for example, a compiler needs to be compiled by another compiler, and that compiler needs to be compiled by another compiler, and so on) then if there is an inefficiency in one of the compilers up the line of inheritance(like the compiler's compiler's compiler's compiler), ...
If X denotes the length of string s1 and Y denotes the length of the string s2, then the edit distance between s1 and s2 is never more than Min(X,Y) or Max(X,Y)? Please explain.
What is language of repeat(L) = {ww | w ∊ L} ? My try: I know it {ww | w ∊ (a,b)*} is context sensitive language. Here , what is meant by "repeat(L)" ? Can you explain it ? It is not a homework question.
See title. And by all inputs I mean providing the functions with the same input and checking whether they give the same output for each case. EDIT If it can be reduced to Halting problem, then how? EDIT 2 @Ariel's answer doesn't satisfy me since given the concrete machine $T$ and input $x$ he states that there exists a...
Suppose I have two generic problems $A_{1}$ and $A_{2}$: the instance of $A_{i}$ is a graph $G$ and a number $t$, and the question is whether a certain parameter $P_{i}(G)$ is at least $t$. Suppose I want to reduce the NP-c problem $A_{1}$ to $A_{2}$. If I can show that $P_{1}(G) \geq x$ if and only if $P_{2}(G) \geq ...
I am searching for book about algorithms (excercises) with solutions. Can you recommend me one?
I know that in general it is undecidable whether two context free grammars generate the same language, but I have to do this exercise and I am finding myself somewhat stuck: G1: S->e|aB|bA B->bS|aBB A->aS|bAA G2: S->e|aSb|bSa|SS I tried to apply Arden's rule in the first grammar, to variables A and B, but I think ...
I am trying to build a LL(1) parse table for the following grammar: S -> L L -> L : L L -> id R R -> ( L ) R -> ( ) R -> Epsilon There are two problems here. First, the L rules are a left recursion and the R rules have ( as the same prefix. So I modified the Grammar to this one: S -> L L -> id R X X -> : L X X -> Epsi...
So I saw this question posed on math.se for $d=3$. Suppose we are given a finite set $X \subset {\mathbb Z}^d$ of $n$ points. The goal is to find a hyper box of integer points $ B = [k_{1,1},k_{1,2}] \times [k_{2,1},k_{2,2}] \times \ldots \times [k_{d,1},k_{d,2}] $ so that the Jaccard distance $d(X,B)$ is minimized. Th...