instruction stringlengths 35 29.1k |
|---|
I am currently reading the IEEE paper A Memory-Efficient Parallel String Matching
Architecture for High-Speed Intrusion Detection by Kai Zheng, Bin Liu, Xin Zhang, and Yunhao Liu.
In the paper they propose a model for
a memory-efficient multiple-character-approaching architecture
consisting of multiple parallel DF... |
I have two strings, where one is a permutation of the other. I was wondering if there is an alternative to Hamming distance where instead of finding the minimum number of substitutions required, it would find the minimum number of translocations required to go from string a to string b.
My strings are always of the sam... |
Possible Duplicate:
Which combinations of pre-, post- and in-order sequentialisation are unique?
I have three different tree traversal of a binary tree Inorder, Preorder and Postorder. I want to identify the tree back from these traversal. I found that a single traversal cant not identify the tree.
So if I'll take ... |
Could anybody please explain what the difference between "bounding" and "pruning" in branch and bound algorithms is?
I'd also appreciate references (preferably books), where this distinction is made clear.
|
From Computer Organisation and Architecture:
The IAS operates by repetitively performing an instruction cycle. Each
instruction cycle consists of two sub cycles. During a fetch cycle,
the opcode of the next instruction is loaded into the IR and the
address portion is loaded into MAR. This instruction may be tak... |
What is the difference between eScience infrastructures and grid computing or distributed computing infrastructures? And what are some of their examples.
I can not distinguish them clearly. Is it how a grid is used make it an e-science platform?
|
I am interested in oriented matroids in the context of directed graphs and optimization. Unfortunately, I know very little of the topic. Is there a book, article or a resource that serves as a good introduction to oriented matroids, especially in the context of directed graphs? It's a bonus if the resource is suitable ... |
Consider a fixed point representation which can be regarded as a degenerate case of a floating number. It is entirely possible to use 2's complement for negative numbers. But why is a sign bit necessary for floating point numbers, shouldn't mantissa bits be using 2's complements?
Also why do the exponent bits use a bia... |
Two problems: Given a known table (boolean or int), convert it to a function that returns the same value using only simple operations (and, or, xor, sum...). For example:
bool table1[] = {0,1} converted to fun (int index) {return index;}
bool table2[] = {0,1,1,0} converted to fun (int index) {return index ^ (index>>1);... |
Definitions: Let $G=(V,E)$ be a DAG without self-loops, and $X \subseteq G$ and $Y \subseteq G$ be graphs.
Input: $X,Y$. Output: The relational composition relational composition $X \circ Y$ in $\mathcal{O}(|E||V|)$.
Case 1: $|E| \le |V|$. Two for loops over $E(X)$ and $E(Y)$: Runtime $ \le \mathcal{O}(|E|^2) \le \mat... |
On the english Wikipedia it says about lazy learning systems:
Because the target function is approximated locally for each query to the system, lazy learning systems can simultaneously solve multiple problems […]
What does this mean? I can only guess what "approximated locally" is supposed to say but even then I have... |
We are given an interval $I$ and several points $p_1,p_2,...,p_n$. We are also given a set of sensors. Each sensor can be represented by an interval on the same line, which means all points lie within the interval can be monitored by the corresponding sensor. The sensors may not have the equal range.
Given the current ... |
All non-deterministic finite automata can be turned into equivalent deterministic finite automata. However, a deterministic finite automata only allows a single arrow per symbol pointing from a state. Therefore, its states should be members of the power set of states of the NFA. This seems to indicate that the number o... |
We have operator and operands, function and formal arguments. Is the difference purely lexical (we use alphanumerics for funciton identifiers but identify operators with special characters, e.g. "+" and ">=") or it is syntactical, like I guessed here
f(a,b) -- prefix notation used for functions
a.f(b) -- infix notation... |
By this possibly good attempt to explain this, the "uniformity" in the Uniform cost search is actually the uniformity of the heuristic function.
Is this explanation correct ? If yes, then don't all un-informed cost searches (like BFS, DFS, etc) have no heurstic and thus, be called as "uniform cost searches" ?
|
I am trying to prove $(n+1)! = O(2^{(2^n)})$. I am trying to use L'Hospital rule but I am stuck with infinite derivatives.
Can anyone tell me how i can prove this?
|
Possible Duplicate:
Dynamic programming table for finding similar substrings is too large
Say I have a sequence $S$ of 0s and 1s such as $S = [1, 0, 0, 1, 0, 1]$
How would I efficiently find a pair $(i, j)$ such that $j - i$ is maximum and $(\sum_{z=i}^j S_z ) \leq K$
UPDATE
The following algorithm solves the above ... |
I got confused while solving the following problem (questions 1–3).
Question
A d-ary heap is like a binary heap, but(with one possible exception) non-leaf nodes have d children instead of 2 children.
How would you represent a d-ary heap in an array?
What is the height of a d-ary heap of n elements in terms of n and d... |
This is a GRE practice question.
If a node in the binary search tree above is to be located by binary tree search, what is the expected number of comparisons required to locate one of the items (nodes) in the tree chosen at random?
(A) 1.75
(B) 2
(C) 2.75
(D) 3
(E) 3.25
My answer was 3 because $n=8$ and $\lg(n)$ ... |
This is a GRE practice question.
Which of the following regular expressions generate(s) no string with two consecutive 1’s? (Note that ε denotes the empty string.)
I. (1 + ε)(01 + 0)*
II. (01+10)*
III. (0+1)*(0+ε)
(A) I only
(B) II only
(C) III only
(D) I and II only
(E) II and III only
My understanding is that neith... |
I have come across the following interesting problem: let $p,q$ be polynomials over the field of real numbers, and let us suppose that their coefficients are all integer (that is, there is a finite exact representation of these polynomials). If needed, we may suppose that the degree of both polynomials is equal. Let us... |
If there are many solutions to a linear program s.t. the objective function is minimized/maximized (= optimal solutions are on an edge of the polytope), how can I force an LP solver to find only an extreme point solution?
|
As the title suggests. Also, such a language must satisfy that neither it nor its complement are semi-decidable. I already know that $All_{TM}, EQ_{TM}, T$ (that is the set of all deciders) satisfy this property. But I tried reducing these to their complements directly, and via some sort of intermediate language, but t... |
I have to design an NFA that will take the strings "token" and token.
I can use $\lambda$ or " to the first state, but then how do I know on the final state if it should have end quotes or not?
|
I was going through the Wikipedia definition of context-sensitive language and I found this:
Each category of languages is a proper subset of the category directly above it. Any automaton and any grammar in each category has an equivalent automaton or grammar in the category directly above it.
I could see that linear... |
Maybe this is quite simple but I have some trouble to get this reduction. I want to reduce Subset Sum to Partition but at this time I don't see the relation!
Is it possible to reduce this problem using a Levin Reduction ?
If you don't understand write for clarification!
|
If $S_1,S_2$ are set of strings, then $S_1S_2 = \{s_1s_2|s_1\in S_1, s_2\in S_2\}$. $S^0=\{\epsilon\}$, $\epsilon$ is the empty string. $S^n = S^{n-1}S$.
Two related problems about represent string as concatenation of other strings.
Given a finite set $S$ of strings, how to decide if there exist a string can be writ... |
Given an adjacency matrix $A_G$ of an undirected graph $G$, it is easy and straightforward to compute the characteristic polynomial $\chi_G(\lambda)$. What about the other way around? The problem can be formulated as follows.
Problem Given a polynomial $P$, decide whether there is a graph $G$ with the corresponding ad... |
Suppose I have a formula, and a lying witness is attempting to make it evaluate to False.
Given a truth table $c(F_1,…, F_n)$, how could you force a lying
witness to contradict herself?
A contradiction is simply when the witness's statements are logically impossible; i.e. that $x_1,x_2$ are each True, but $x_1 \sp... |
Does there exist a procedure that determines if a polytime machine prints a certain string, and does so in less time than the machine itself takes to run?
Define a machine $a$ that analyzes another machine $b$, input $i$, and string $r$:
$a(b,i,r) = b(i) \text{ prints } r$ $[T_b = O(n^k), k >= 2]$
Is there an... |
I want to know how can i find number of cpu cores/processor supported given i have the MIPS value?
For e.g I want to know the number of matching cores/processor to process speed of 18 triilion instructions / sec.
|
Parallel processes interfere with each other in many ways, by competing for shared resources such as shared caches, memory, disks, etc.
Would it be possible to determine latent factors just with a runtime analysis, by means of comparing the runtime of the respective applications while running them many times in differe... |
Let
$$f(x)=\begin{cases} x \quad \text{if Goldbach's conjecture is true
}\\ 0 \quad \text{otherwise}\end{cases}$$
Show that f(x) is primitive recursive.
I know a primitive recursive function is obtained by composition or recursion, but I don't know what should I do about this problem.
|
I am studying best first search as it compares to BFS (breadth-first search) and DFS (depth-first search), but I don't know when BFS is better than best-first search. So, my question is
When would best-first search be worse than breadth-first search?
This question is one of the back exercises in Artificial Intellige... |
I have two pieces of code in a function which I'm trying to calculate the asymptotic running time for:
for (int x = 0; x < y; x++) {
total += total;
total += x;
}
and:
while (y > 0) {
total -= y;
y = y/2;
}
Combining those two pieces of code, what is the run time of that function and how do I ... |
Is the complement of the Hamiltonian Path problem known to be in $\mathsf{NP}$? I could not find explanations saying that it is, but then neither were there any claims saying that it is not in $\mathsf{NP}$.
|
I have some difficulties performing the worst case analysis on this algorithm.
The outermost loop is executed $2N$ times.
The while loop, in the worst case, will increase by $2$ each time, so it performs $i/2$ basic operations ($*2$ because double call)
for (i=1; i<=2*N; i++) {
j = 0;
while (j <= i) {
... |
Are there any superpolynomial time set $\mathsf{SP}$ in between $\mathsf{P}$ and $\mathsf{EXPTIME}$ such that the problem $\mathsf{SP}=\mathsf{NSP}$ has a known answer?
UPDATE: It must be defined by time and strictly between $\mathsf{P}$ and $\mathsf{EXPTIME}$. I was wondering, what if Cobham's thesis is wrong and we a... |
I am not talking about NP-indeterminate class because those problems have to be shown to not exist either in P or NP-complete class and existence of such problems proves P!=NP. I am interested to know if we are half-way there i.e. problems that have been proven to be not NP-complete but are in NP but we don't know if t... |
I've been trying to implement Brzozowski's algorithm but I've just discovered that it creates suboptimal automata for a certain class of inputs, having one more state than what is really needed in the result. I can show it on a trivial automaton:
a b a b a b a b a b
>0... |
I'm trying to figure out why NOT and CNOT gates are not sufficient to create all bijective functions in classical circuits. I have been struggling on this for hours, and just can't make sense of it.
I feel it has something to do with the Toffoli gate, as it contains an (implicit) AND operation, and I feel that's what m... |
Let's say I found a 2-approximation algorithm for a certain problem and I want to show that the analysis is tight.
Do I now need to come up with an example of generic size $n$ or does it suffice to show that I have an example of size $10$ for which the algorithm yields $2OPT$?
|
I have the following problem:
Define the keyed function F as follows: On input k ∈ {0, 1}$^n$
and x ∈ {0, 1}$^n$ , Fk(x) = k ⊕ x.Rigorously prove that F is not a pseudorandom function.
How do I approach a proof against pseudorandomness for a keyed function? I don't know where to start with this one.
|
First, consider this simple problem --- design a data structure of comparable elements that behaves just like a stack (in particular, push(), pop() and top() take constant time), but can also return its min value in $O(1)$ time, without removing it from the stack. This is easy by maintaining a second stack of min value... |
The Radon transform is used to take 2d projections of an object and create a 3d representation.
It seems like it would be possible to apply such a transform in 3d graphics in games (although possibly too slow to be practical).
For example, a very simple way to display an object is to use a 3d rectangle and texture map ... |
I am having issue with designing contex free grammar for the following language:
$L = \{0^n 1^m \, | \, 2n \leq m \leq 3n \}$
I can design for the individual cases i.e. for $m \geq 2n$ and $m \leq 3n$ but don't know how should i combine both. Or is it a different approach altogether?
|
Let's have two statements
(value > 10)
(value < 25)
And a list of items with the following values
10
20
30
This is what a truth table would give
Item Value (value > 10) (value < 25)
---- ----- ------------ ------------
1 10 FALSE TRUE
2 20 TRUE TRUE
3 30 TRUE ... |
I was asked a question on how to use a pair of Queues to create a Stack and how to use a pair of Stacks to create a Queue. Any thoughts on how I would do this? Right now I don't even know where to start.
|
I have been thinking about why the dynamic programming approach to finding the optimal matrix chain order is better than a brute force approach that finds the optimal order by exploring all nested orders. The more I think about it, the more I feel strongly that the dynamic programming solution considers all possible ch... |
This question uses the following definition of a complete binary tree†:
A binary tree $T$ with $N$ levels is complete if all levels except possibly the last are completely full, and the last level has all its nodes to the left side.
The following is an excerpt from Algorithms:
It ($\log N$) is also the depth of a co... |
I'm trying to find CFG's that generate a regular language over the alphabet {a b}
I believe I got this one right: All strings that end in b and have an even number of b's in total:
$\qquad S \to SS \\
\qquad S \to YbYb \mid \varepsilon \\
\qquad Y \to aY \mid \varepsilon$
However, Im not sure how to accomplish this wit... |
Is the complement of a Non-Recognizable language
Recognizable
Non-Recognizable
May be Recognizable, May be Non-recognizable. I.e cant comment.
A mathematical proof would be of great help since im unable to think of any way to prove this.
I did some research on this and found below examples. Im specifying complement u... |
Instancing in GPU's, from my little knowledge, simply draw the same object at multiple locations. Each "instance" is just a copy of the same model at a different location. Any local effects, such as animation, would effect all instances. The performance improvement comes from gpu being able to deal with virtually all t... |
ERROR: type should be string, got "https://www.interviewstreet.com/challenges/dashboard/#problem/4f1c88e0dec8a\n\nFairy Chess (35 Points)\nYou have a $N \\times N$ chess board. An $S$-leaper is a chess piece which can move from square $(x_1,y_1)$ on the board to any other square $(x_2,y_2)$ if $|x_1 - x_2| + |y_1 - y_2| \\le S$. The chess board may also contain some pawns. The leaper cannot land on the same square as a pawn. In how many ways can a leaper move $M$ times on the board?\nInput:\n The first line contains the number of test cases $T$. $T$ cases follow. Each case contains integers $N$, $M$ and $S$ on the first line. The next $N$ lines contains $N$ characters each. The $i$th character on the $j$th line is a . if the corresponding chess square is empty, P if there is a pawn, or L if the leaper is situated on that square.\nOutput:\n For each case, output the number of ways the leaper can make $M$ moves. Output each answer modulo 1000000007.\nConstraints:\n $$\\begin{gather}\n1 \\le T \\le 10 \\\\\n1 \\le S \\le N \\le 200 \\\\\n1 \\le M \\le 200 \\\\\n\\end{gather}$$\n There will be exactly one L character on the board.\nSample Input:\n3\n4 1 1\n....\n.L..\n.P..\n....\n3 2 1\n...\n...\n..L\n4 3 2\n....\n...L\n..P.\nP...\n\nSample Output:\n4\n11\n385\n\n\nI wrote a DP solution but with O(N^5).\n\nPsuedocode for ways function:\n\nMemoize[Xmax][Ymax][Nmax];\n\nways(int X, int Y, int M) // (X,Y) current co-ordinates and M is number of moves to make\n{\n if(Memoize[X][Y][M] != -1) // != -1 means we already have the result\n return Memoize[X][Y][M];\n sum=0;\n for all (u,v) such that |X-u| + |Y-v| <= S\n sum += ways(u, v, M-1);\n\n Memoize[X][Y][M] = sum;\n return sum;\n\n}\n\n\nCode:\n\n/* Enter your code here. Read input from STDIN. Print output to STDOUT */\n\n#include <stdio.h>\n#include <stdlib.h>\n\nlong ways(long ***DP, char **Chess, int X, int Y, int S, int N, int M);\n\nint main()\n{\n int T;\n scanf(\"%d\", &T);\n while(T>0)\n {\n int N, M, S;\n scanf(\"%d\", &N);\n scanf(\"%d\", &M);\n scanf(\"%d\", &S);\n long ***DP = (long ***) malloc(sizeof(long **) * N);\n int i,j,k;\n char **Chess = (char **)malloc(sizeof(char *) *N);\n int Xstart;\n int Ystart; //printf(\"N=%dM=%dS=%d\\n\", N, M, S);\n for(i=0;i<N;i++)\n {\n Chess[i] = (char *)malloc(sizeof(char) *N);\n DP[i] = (long **)malloc(sizeof(long *) * N);\n for(j=0;j<N;j++)\n { //printf(\"i=%dj=%d\\n\", i, j);\n DP[i][j] = (long *)malloc(sizeof(long) *(M+1));\n char a;\n scanf(\" %c\", &a);\n if(a=='L')\n {\n Xstart = i;\n Ystart = j;\n }\n Chess[i][j] = a;\n //printf(\"jf=%d\\n\", j);\n }\n }\n\n for(i=0;i<N;i++)\n {\n for(j=0;j<N;j++)\n {\n for(k=1;k<M+1;k++)\n {\n DP[i][j][k] = -1;\n }\n DP[i][j][0] = 1;\n }\n }\n\n printf(\"%ld\\n\", ways(DP, Chess, Xstart, Ystart, S, N, M));\n T--;\n }\n}\n\nlong ways(long ***DP, char **Chess, int X, int Y, int s, int N, int M)\n{\n if(DP[X][Y][M] !=-1)\n {\n //printf(\"X=%d Y=%d M=%d Val=%ld\\n\", X, Y, M, DP[X][Y][M]);\n return DP[X][Y][M];\n }\n else\n {\n long sum1 = 0;\n\n\n int S,k;\n sum1 += ways(DP, Chess, X, Y, s, N, M-1);\n\n for(S=1;S<=s;S++)\n {\n for(k=0;k<=S;k++)\n {\n if(k!=0 && (S-k)!=0)\n {\n if(X+k<N && Y+(S-k) <N && Chess[X+k][Y+(S-k)] != 'P')\n {\n Chess[X+k][Y+(S-k)] = 'L';\n Chess[X][Y] = '.';\n sum1 += ways(DP, Chess, X+k, Y+(S-k), s, N, M-1);\n Chess[X+k][Y+(S-k)] = '.';\n Chess[X][Y] = 'L';\n }\n if(X+k<N && Y-(S-k)>=0 && Chess[X+k][Y-(S-k)] != 'P')\n {\n Chess[X+k][Y-(S-k)] = 'L';\n Chess[X][Y] = '.';\n sum1 += ways(DP, Chess, X+k, Y-(S-k), s, N, M-1);\n Chess[X+k][Y-(S-k)] = '.';\n Chess[X][Y] = 'L'; \n }\n if(X-k>=0 && Y+(S-k) <N && Chess[X-k][Y+(S-k)] != 'P')\n {\n Chess[X-k][Y+(S-k)] = 'L';\n Chess[X][Y] = '.';\n sum1 += ways(DP, Chess, X-k, Y+(S-k), s, N, M-1);\n Chess[X-k][Y+(S-k)] = '.';\n Chess[X][Y] = 'L';\n }\n if(X-k>=0 && Y-(S-k) >=0 && Chess[X-k][Y-(S-k)] != 'P')\n {\n Chess[X-k][Y-(S-k)] = 'L';\n Chess[X][Y] = '.';\n sum1 += ways(DP, Chess, X-k, Y-(S-k), s, N, M-1);\n Chess[X-k][Y-(S-k)] = '.';\n Chess[X][Y] = 'L';\n }\n\n\n }\n else if(k==0 && (S-k)!=0)\n {\n if(Y+(S-k)<N && Chess[X][Y+(S-k)] != 'P')\n {\n Chess[X][Y+(S-k)] = 'L';\n Chess[X][Y] = '.';\n sum1 += ways(DP, Chess, X, Y+(S-k), s, N, M-1);\n Chess[X][Y+(S-k)] = '.';\n Chess[X][Y] = 'L';\n }\n if(Y-(S-k)>=0 && Chess[X][Y-(S-k)] != 'P')\n {\n Chess[X][Y-(S-k)] = 'L';\n Chess[X][Y] = '.';\n sum1 += ways(DP, Chess, X, Y-(S-k), s, N, M-1);\n Chess[X][Y-(S-k)] = '.';\n Chess[X][Y] = 'L';\n }\n\n\n }\n else if(k!=0 && (S-k)==0)\n {\n if(X+k<N && Chess[X+k][Y] != 'P')\n {\n Chess[X+k][Y] = 'L';\n Chess[X][Y] = '.';\n sum1 += ways(DP, Chess, X+k, Y, s, N, M-1);\n Chess[X+k][Y] = '.';\n Chess[X][Y] = 'L';\n }\n if(X-k>=0 && Chess[X-k][Y] != 'P')\n {\n Chess[X-k][Y] = 'L';\n Chess[X][Y] = '.';\n sum1 += ways(DP, Chess, X-k, Y, s, N, M-1);\n Chess[X-k][Y] = '.';\n Chess[X][Y] = 'L';\n }\n\n\n }\n }\n }\n //printf(\"X=%d Y=%d M=%d Val=%ld\\n\", X, Y, M, sum);\n DP[X][Y][M] = sum1;\n return sum1;\n } \n}\n\n" |
Inputs. I am given a finite set $S$ of symbols. I know there should exist some total order $<$ on $S$, but I'm not given this ordering and it could be anything.
I am also given a collection of assertions. Each assertion takes the form $s_1<s_2<\cdots<s_m$, where $s_1,\dots,s_m$ form a subset of the symbols of $S$. T... |
Consider the following specification technique.
A specification consists of a finite set of triples $\langle C, A, C' \rangle$,
where $A$ is the name of an action and $C, C'$ are conditions, that is,
propositional formulas over propositional variables.
Example rules (in a more suggestive notation):
$C_1 \wedge \neg(C_... |
I'm looking to work out the big-O notation for the following:
$$\frac{n^{s + 1} - 1}{n - 1} - 1$$
I have a feeling the result is $O\left( n^s \right)$ but I'm not sure how to prove it.
Any help greatly appreciated! :)
|
In some literature, as well as in Wikipedia, the middle term parameter m of Mersenne twister is called "number of parallel sequences". Why? What is meant here by "parallel sequences"?
|
Let $f(N)$ be the average number of full nodes (nodes with two children) in an $N$-node binary search tree.
Determine the values of $f(0)$ and $f(1)$.
Given that for $N > 1$,
$\qquad \displaystyle f(N) = \frac{N-2}{N} + \frac{1}{N} \sum_{i=0}^{N-1} [f(i) + f(N - i - 1)]$,
show that $f(N) = \frac{N - 2}{3}$.
Using t... |
In my variant of the assignment problem I have a set $A$ of agents and a set (of possibly different cardinality) $T$ of tasks. Each agent needs to be assigned exactly $n$ or $n+1$ tasks, and each task needs to be assigned to exactly $m$ or $m+1$ agents.
It is guaranteed this this is possible: the segment $\left[ |A|n, ... |
I was studying operating system concepts from Silberschatz, Galvin and Gagne's book (sixth edition) and I have some questions about the flow of execution of a program. A figure explains the processing of the user program:
We get an executable binary file when we reach the linkage editor point. As the book says,
The p... |
From Van Emde Boas trees lecture:
We will use the idea of superimposing a tree of degree ${u^{1/2}}$ on top of
a bit vector, but shrink the universe size recursively by a square
root at each tree level. The ${u^{1/2}}$ items on the first level each hold
structures of ${u^{1/4}}$ items, which hold structures of ${... |
In order to achieve the time complexity of $O(\log \log u)$ for van Emde Boas trees I read in this lecture that the the universe size $u$ is chosen as $u = 2^{2^k}$ for some integer $k$ for van Emde Boas trees. Why choose $u$ to be of this specific form ?
|
Speeding up a new floating-point unit by 2 slows down data cache accesses by a factor of 2/3 (or a 1.5 slowdown for data caches). If old FP unit took 20% of program's execution time and data cache accesses took 10% of program's execution time, what is the overall speed up?
I solved this problem using amdahl's law:
F... |
This is a homework problem for my introduction to algorithms course.
Recall the scheduling problem from Section 4.2 in which we sought to
minimize the maximum lateness. There are $n$ jobs, each with a deadline
$d_i$ and a required processing time $t_i$, and all jobs are available to be
scheduled starting at time... |
$H(x)$ is the program size complexity of $x$ for some universal Turing machine $U$. $H$ is not computable, however $H$ is "computable in the limit from above".
From my notes:
i.e the set $\{(x,n) \mid x \in B^*,n \geq 0, H(x) \leq n\}$ is computably enumerable.
Can someone tell me what this means? I understand the in... |
Here is my proof, but I am not sure whether it is correct.
We know:
$\qquad \begin{array}{l}
\forall {c_1},\exists {n_1},0 \le f\left( n \right) \le {c_1}g\left( n \right),\forall n \ge {n_1} \\
\forall {c_1},\exists {n_2},0 \le g\left( n \right) \le {c_1}h\left( n \right),\forall n \ge {n_2} \\
\end{array}$
Hope ... |
I'm a none-computer-science-student and get some knowledge on AI by taking the CS188.1x Course (Artificial Intelligence) on www.edx.org .
Currently, I am working on the "Search in Pacman" Project; the sources can be found online at Berkley CS188 . I have problems finding an good solution for "Finding All the Corners", ... |
I have a problem that can be reduced to an assignment problem.
(In a previous question i found out how to do that.)
Which means we have a set $A$ of agents and a set $T$ of tasks as well as a cost function $c(i,j)$. We need to find an assignment so that the total cost is minimal.
The hungarian algorithm can find an opt... |
This is a problem from Interview Street in Dynamic Programming section.
https://www.interviewstreet.com/challenges/dashboard/#problem/4f2c2e3780aeb
Billboards(20 points)
ADZEN is a very popular advertising firm in your city. In every road you can see their advertising billboards. Recently they are facing a serious c... |
Least cost travel by intermixing different airline routes having linear discount functions:
Lowest air fare route chosen by mixing different routes provided by different airline having different discount functions (like some airline can give 25% discount if fare crosses $5k) so that total cost of travel is minimized af... |
From Wikipedia about randomized algorithms
One has to distinguish between algorithms that use the random
input to reduce the expected running time or memory usage, but always
terminate with a correct result in a bounded amount of time, and
probabilistic algorithms, which, depending on the random input, have a ch... |
I know the general concept of recursion. I came across the concept of tail recursion while studying the quicksort algorithm. In this video of quick sort algorithm from MIT at 18:30 seconds the professor says that this is a tail recursive algorithm. It is not clear to me what tail recursion really means.
Can someone ... |
I have a bipartite graph with $|E|=O(|V|^2)$, a super-source and a super-sink. I am looking for the min-cost max-flow (the max-flow of all possible max-flows that has the minimum cost).
For the sake of my question, denote $n=|E|$.
Are there algorithms that will run in $O(n^2)$, or even $O(n\log(n))$, or for that matter... |
If we suppose that we'd like to convert an instance of 3-SAT to an instance of 4-SAT, by how much can we reduce the amount of variables?
CONVERSION METHODS FOR PRODUCTS OF SUMS
If we are given a 3-SAT clause $(A \lor B \lor C)$, we can readily convert this to 4-SAT by rewriting it as $(A \lor B \lor C \lor x) \land (A ... |
This question has gotten a lot of attention on SO:
Sorting 1 million 8-digit numbers in 1MB of RAM
The problem is to sort a stream of 1 million 8-digit numbers (integers in the range $[0,\: 99\mathord{,}999\mathord{,}999]$) using only 1 MB of memory ($2^{20}$ bytes = $2^{23}$ bits) and no external storage. The program ... |
The only examples I've seen use bits as a measurement of entropy, but all these examples happen to use binary code alphabets. If we wanted to see how well a coding with a code alphabet of length n works, would we measure entropy in units of n?
Or would it make sense to stay using bits if we're comparing codings with bi... |
Let the input alphabet be $\Sigma = \{a,b,c\}$ and L be the language of all words in which all of the a’s come before all of the b’s and there are the same number of a’s as b's and arbitrarily many c’s that can be in front, behind or among the a’s and b’s.
Some words in L are: abc ccacaabcccbccbc
I know that the langu... |
The following is an excerpt from the Wikipedia article on the Miller-Rabin primality test:
It can be shown that for any odd composite $n$, at least $\frac{3}{4}$ of the bases $a$ are witnesses for the compositeness of $n$.
In the Fermat primality test, if $n$ is not a Carmichael number, at least half of the bases $a$... |
I'm reading a paper that refers to the limit as n goes to infinity of Rényi entropy. It defines it as ${{H}_{n}}\left( X \right)=\dfrac{1}{1-n} \log_2 \left( \sum\limits_{i=1}^{N}{p_{i}^{n}} \right)$. It then says that the limit as $n\to \infty $ is $-\log_2 \left( p_1 \right)$. I saw another article that uses the maxi... |
If we regard a tree as a partial ordered set, it becomes a special case of a join-semilattice. For a join-semilattice, we want to be able to compute the (unique) least upper bound of two elements (more or less) efficiently. In the case of a tree, a data structure which would enable this would be to store for each eleme... |
Do "inductively" and "recursively" mean very similar?
For example, if there is an algorithm that determines a n-dim vector by determine its first k+1 components based on its first k components having been determined, and is initialized with the first component, would you call it works recursively or inductively? I have... |
I will preface my question with the definition of a simple tree that applies to my question:
A simple tree is an undirected and connected graph with no cycles.
I am having difficulty coming up with a compelling argument that a tree of the above definition can be constructed by taking a set of disjoint valid graphs an... |
I know that we can visualize a Non deterministic TM as a TM which splits into multiple copies of itself whenever it sees a non deterministic path (Yes, I also know that this is just a visualization and is usually used by beginners like me for understanding non determistisism).
Further, I also know that a Decider is a ... |
A threshold gate implementing a linear threshold function on $n$ boolean inputs $x_1, x_2 \ldots, x_n$ is given by the equation:
$w_1 x_1 + w_2 x_2 + \ldots, w_n x_n \ge t$
where $w_1, \ldots, w_n, t \in \mathbb{R}$. The $w_i$'s are called the weights of the threshold function and $t$ is called the threshold, and natur... |
Doing the following exercise:
Let $\overline{HALT(x,y)}$ be defined as
$\overline {HALT(x,y)} \iff \text{program number y never halts on input x}$
Show that it is not computable.
Just want to make sure I have understood the concept correctly. We had in a theorem that HALT(x,y) is not computable which means that we ca... |
If $f(x_1,\dots, x_n)$ is a total function that for some constant $K$, $f(x_1,\dots, x_n) \leq K$ for all $x_1,\dots, x_n$ then $f$ is computable.
I want some hints on how to prove/disprove the above claim. This an exercise from the book Computability, Complexity, and Languages. As I didn't find the solutions to the e... |
Given $a,b,c,d \in \mathbb N$ and $b,d \notin \{0\}$,
$$
\begin{eqnarray*}
\frac a b < \frac c d &\iff& ad < cb
\end{eqnarray*}
$$
My questions are:
Given $a,b,c,d$
Assuming we can decide $x < y \in \mathbb Z$ in $\mathcal{O}(|x| +|y|)$, is there any way of deciding $ad<cb$ without having to preform the multiplication... |
I'm looking for a $\Theta$ approximation of
$$T(n) = T(n-1) + cn^{2}$$
This is what I have so far:
$$
\begin{align*}
T(n-1)& = T(n-2) + c(n-1)^2\\
T(n) &= T(n-2) + c(n-1) + cn^2\\[1ex]
T(n-2) &= T(n-3) + c(n-2)^2\\
T(n) & = T(n-3) + c(n-2)^2 + c(n-1)^2 + cn^2 \\[1ex]
T(n-3) &= T(n-4) + c(n-3)^2 \\
T(n) &= T(n-4) + c(n-... |
I am trying to understand dynamic programming and I am watching this mit video. If you guys could take some time out , can you refer to the slide on 41:36 . Why is the height m+n. I just don't get it why is the heigh of this recurrence tree m+n.
http://videolectures.net/mit6046jf05_leiserson_lec15/
Thank you.
|
In my Java class, we are learning about complexity of different types of collections.
Soon we will be discussing binary trees, which I have been reading up on. The book states that the minimum height of a binary tree is $\log_2(n+1) - 1$, but doesn't offer further explanation.
Can someone explain why?
|
If $L$ is a regular language, prove that the language
$L_1 = \{ uv \mid u \in L, |v| =2 \}$
is also regular.
My idea: $L$ can be represented as a DFA and then you could add 2 consecutive transitions from every final state for the letters of $v$, creating a new NFA diagram. Is that correct? I'm not sure how to mak... |
Imagine two machines of different architecture which produce output of a standard format.
If you have a program for one machine and can observe it's operation and output, what techniques exist to automatically produce an equivalent program for the alternate architecture?
By equivalent I mean produces equal output (by s... |
I'm trying to trace back the origin of the general concept of Discrete Event Simulation and found a 1968 article by Fishman and Kiviat mentioning the term. It is titled The statistics of discrete-event simulation.
However, I'm unable to verify this as the origin of the term.
Is there further historical information on t... |
From , the proofs by the probabilistic method are often said to be non-constructive.
However, a proof by probabilistic method indeed designs a randomized algorithm and uses it for proving existence. Quoted from p103 of Randomized Algorithms
By Rajeev Motwani, Prabhakar Raghavan:
We could view the proof by the proba... |
I want to learn quantum computation and information. I am studying from Nielsen & Chuang book for this.
Is there any online vedio (lecture series) starts from
basics of quantum computation and information up to factorization, discrete log, search etc?
|
$L_1$ and $L_2$ are two languages defined on the alphabet $\sum$.
$L_1$ is reducible to $L_2$ in polynomial time. Which of the following
cannot be true?
$L_1 \in P$ and $L_2$ is finite
$L_1 \in NP$ and $L_2 \in P$
$L_1$ is undecidable and $L_2$ is decidable
$L_1$ is recursively enumerable and $L_2$ is recursive
... |
What is the time complexity of computing $\frac{1}{2^n} {{n}\choose{(n+2)/2}}$?
$$\frac{1}{2^n} {{n}\choose{(n+2)/2}} = \frac{1}{2^n} \frac{n(n-1)\cdots ((n-2)/2)}{((n+2)/2) (n/2) \cdots 1}$$
The numerator and denominator in $\frac{n(n-1)\cdots ((n-2)/2)}{((n+2)/2) (n/2) \cdots 1}$ will take $O(n)$ multiplications.
$2^... |
I was told that quantum computers are not computationally more powerful than Turing machines.
Could someone kindly help in giving some literature references explaining that fact?
|
I have to be honest this is a homework problem, but I just need to discuss this with some one. The problem is there is a row of n houses, with different profit e.g profit1 for house 1, it can be either positive or negative value. But the aim is to maximize the profit by buying a subset of these houses. So infact, you s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.