instruction
stringlengths
0
29.8k
⌀
|terminology|machine-learning|
As it is, your formula is ambiguous; it is not clear which pair of parentheses to insert in order to get a binary tree. Both $\qquad \displaystyle \varphi_1 \lor (\varphi_2 \lor \varphi_3)$ and $\qquad \displaystyle (\varphi_1 \lor \varphi_2) \lor \varphi_3$ are feasible. Luckily for you, $\lor$ is associat...
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 ...
|algorithms|data-structures|
In short: non-determinism means to have multiple, equally valid choices of how to continue a computation. Randomisation means to use an external source of (random) bits to guide computation. --- In order to understand nondeterminism, I suggest you look at finite automata (FA). For a *deterministic* FA (DFA), the ...
It seems that your tables are 1-dimensional. So basically for an integer $x$ you define some value $T[x]$ and you are looking for a function $f$ such that $f(x)=T[x]$. There is a name for the problem that tries to find a function that runs through a given set of sample points, this is known as **interpolation**. Yo...
null
We are given an interval I on a line. Suppose we want to monitor every point in the interval. We are also given a set of sensors. Each sensor can be repre- sented by an interval on the same line, which means all points lie within the interval can be monitored by the corresponding sensor. Given the current positions of ...
Sensor Cover Problem
|algorithms|
We are given an interval $I$ on a line. Suppose we want to monitor every point in the interval. 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. Given the current positions...
|algorithms|computational-geometry|
Consider the following family of languages: $L_n = \{ x_1, x_2, \ldots, x_k \# x_{k+1}: \exists i \in \{1, \ldots, k\} \text{ with } x_i = x_{k+1} \}$ The alphabet of $L_n$ is $\{\#, 1,\ldots, n \}$. There is an NFA with $O(n)$ states that recognizes the language $L_n$. It has $n$ copies. In the $i$th copy we g...
One operation that transforms an NFA into another NFA but does not do so for a DFA is reversal (point all the arrows the other way round, and swap initial states with accepting states). The language recognized by the transformed automaton is the reversed language $L^R = \{u_{n-1}\ldots u_0 \mid u_0\ldots u_{n-1} \in L\...
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...
How to prove that DFAs from NFAs can have exponential number of states?
|formal-languages|
Another example is the language of all words which miss one symbol of the alphabet. If the alphabet is of size $n$, then a NFA can "guess" a starting state and so accept the language with $n$ states. On the other hand, using Nerode's theorem it is easy to see that the size of the minimal DFA for this language is $2^n$....
|automata|finite-automata|nondeterminism|
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][1] f(a,b) -- prefix notation used for functions a.f(b) ...
What is the difference between operator and function?
|terminology|
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][1] f(a,b) -- prefix notation used for functions a.f(b) ...
I would say No ! ... but it depends on many factors. It depends on $I$ length and $R_s$ (sensing range of sensors) - because if $\cup _s \in S R_s < I$ - then it there is no way to cover each point. It also depends on the initial configuration of the sensors. Assume that they are all at one endpoint of the line i...
{"Voters":[{"Id":867,"DisplayName":"AJed"}]}
{"Voters":[{"Id":867,"DisplayName":"AJed"}]}
I would say No ! ... but it depends on many factors. It depends on $I$ length and $R_s$ (sensing range of sensors) - because if $\cup _{s \in S} R_s < I$ - then it there is no way to cover each point. It also depends on the initial configuration of the sensors. Assume that they are all at one endpoint of the line...
Let's apply Branch and Bound to [Knapsack][1], hopefully this will make the concept clear to you. We have $n$ items, labelled $1$ through to $n$. $v_i$ is the value of the $i$th item, and $w_i$ its weight. We try to fit them in a knapsack that can contain up to $T$ weight in total, and we try to maximize the sum of ...
null
The idea of a routing table in Pastry (and all structured P2P networks) is to minimize its size, while guaranteeing a quicker routing. The routing algorithm of Pastry goes as follows: Step A. A node u searches for an object A by firstly looking it up in its leaf set. Step B. If it was not available, then the ...
I would say No ! ... but it depends on many factors. It depends on $I$ length and $R_s$ (sensing range of sensors) - because if $\cup _{s \in S} R_s < I$ - then it there is no way to cover each point. It also depends on the initial configuration of the sensors. Assume that they are all at one endpoint of the line...
I would say No ! ... but it depends on many factors. It depends on $I$ length and $R_s$ (sensing range of sensors) - because if $\cup _{s \in S} R_s < I$ - then it there is no way to cover each point. It also depends on the initial configuration of the sensors. Assume that they are all at one endpoint of the line...
By [this][1] 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` sea...
Why is Uniform cost search called "uniform" cost search?
|artificial-intelligence|search-algorithms|heuristics|
the book is describing low level machine language architecture associated with the CPU & what is also known as "microcode". it would be possible to design opcodes that use multiple registers (that does occur in some mostly uncommon cases) but most opcodes generally refer to one register or a memory location, unless its...
null
By [this][1] 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` sea...
|terminology|artificial-intelligence|search-algorithms|heuristics|
There are two ways to interpret your dataset generating process. The first produces all even numbers between $2$ and your bound: $2$, $4$, $6$, $8$, …; the second produces all powers of $2$ between $2$ and your bound: $2$, $4$, $8$, $16$, … An integer $N$ requires roughly $\log_{256} N$ bytes to store. Therefore, if yo...
null
Historically, my guess is that the difference is rooted in how things were (and still are) translated into machine code. An *operator* such as addition of integers or exclusive-or of booleans would be translated into one (or few) assembler commands which would be directly executed by the processor (resp. its ALU). I...
|terminology|programming-languages|
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? Thanks!
how to prove (n+1)! = O[2^(2*n)]
|algorithms|
|asymptotics|
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$
Longest range with sum smaller than K
|subsequences|
> if we have a list of $n$ numbers we need $\log n$ bits No: if we have a list of numbers between $0$ and $2^k - 1$, we need $k$ bits. There is no relationship between $k$ and $\log n$ in general. If the numbers are all distinct, then $\log n \ge k$, and radix sort on distinct numbers therefore has a time complex...
Two's complement makes sense when the two entities in question have the same "units" and the same "width". By width I mean that, say, if you're adding an N bit number and an M bit number, where N and M are different, then you better not use two's complement. For floating point numbers, we have the problem of units: if ...
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 curre...
I got confused while solving the following problem... ###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. a. How would you represent a *d*-ary heap in an array? b. What is the height of a *d*-ary heap of *n* elements in t...
A d-ary heap problem from CLRS
|time-complexity|sorting|
You should be aware that there are two different definitions of nondeterminism being thrown around here. 1) As wikipedia defines it, pretty much "not determinism", that is, any algorithm that doesn't always return the same answer on the same inputs. Randomized algorithms are a special case of "not deterministic" alg...
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? Thanks!
how to prove (n+1)! = O[2^(2^n)]
You can compare ratios of adjacent values: $(n+1)!/n! = n+1$ versus $2^{2^n}/2^{2^{n-1}} = 2^{2^{n-1}}$. Since $n+1\leq 2^{2^{n-1}}$ for $n \geq 1$, you can prove using mathematical induction that $(n+1)! \leq 2^{2^n}$.
|integers|efficiency|storage|
|data-structures|time-complexity|runtime-analysis|
I got confused while solving the following problem... ###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. 1. How would you represent a *d*-ary heap in an array? 2. What is the height of a *d*-ary heap of *n* elements in...
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?
How to prove $(n+1)! = O(2^{(2^n)})$
Using de l'Hôpital's rule on discrete functions is meaningless; you would have to use continuous extension. For factorials, that would be the [Gamma function](https://en.wikipedia.org/wiki/Gamma_function). For discrete functions, there is [Stolz–Cesàro](http://math.stackexchange.com/q/92945/3330). In either case, co...
Well, since this upper bound is not nearly tight, you can just use basic transformations to get $$(n+1)!< (n+1)^{(n+1)}=2^{\log (n+1)^{(n+1)}}= 2^{(n+1)\log (n+1)}=O(2^{n\log n})\subset O(2^{(2^n)}). $$
Truth to be told, I am not completely sure about my answer, so take it with a grain of salt: Uniform Cost Search is just a variant of Best-First Search. Among other variants, take Breadth-First Search where $f(n)$ equals $d(n)$, its depth. This actually means that nodes are not treated *uniformly* since different p...
This is a GRE practice question. ![BST n=8][1] 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 [1]: https://i.stack...
Average number of comparisons to locate item in BST
|binary-trees|search-trees|
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 ...
Which of the following regular expressions generate(s) no string with two consecutive 1’s?
|regular-expressions|
This is a GRE practice question. ![BST n=8][1] 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 [1...
Using Yuval's reduction, the problem can be reformulated as "Find the largest range $(i,j)$ in a binary string $S \in \{0,1\}^*$ such that the number of $1$s contained in the range is $\leq K$" (see [this question][1]). The idea is to start with an initial valid range $(0,j)$ of length $maxlen$ and then shift the "w...
Using Yuval's reduction, the problem can be reformulated as "Find the largest range $(i,j)$ in a binary string $S \in \{0,1\}^*$ such that the number of $1$s contained in the range is $\leq K$" (see [this question][1]). The idea is to start with an initial valid range $(0,j)$ of length $maxlen$ and then shift the "w...
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...
Decidability of a problem concerning polynomials
|computability|undecidability|computer-algebra|
Using Yuval's reduction, the problem can be reformulated as "Find the largest range $(i,j)$ in a binary string $S \in \{0,1\}^*$ such that the number of $1$s contained in the range is $\leq K$" (see [this question][1]). The idea is to start with an initial valid range $(0,j)$ of length $maxlen$ and then shift the "w...
Recall, how *expected number* is defined. You count the for every element $X$ in the tree the number of comparisons it takes to locate it, say $C(X)$. Then $$E[\text{# of comparisons}]=\sum_{X\in\{A,\ldots,H\}} p_X \cdot C(X),$$ where $p_x$ denotes the probability that $X$ is chosen, which is the same for all $X$, na...
This is a GRE practice question. ![BST n=8][1] 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 [1...
|binary-trees|probability-theory|search-trees|average-case|
> **Possible Duplicate:** > [Dynamic programming table for finding similar substrings is too large](http://cs.stackexchange.com/questions/4994/dynamic-programming-table-for-finding-similar-substrings-is-too-large) <!-- End of automatically inserted text --> Say I have a sequence $S$ of 0s and 1s such as $S = [1, ...
{"OriginalQuestionIds":[4994],"Voters":[{"Id":683,"DisplayName":"Yuval Filmus"},{"Id":39,"DisplayName":"Gilles"}]}
null
I'm not knowledgeable in that field either, but I think I can provide a non-constructive answer. The first-order theory of real closed fields is decidable. Your problem can be stated as a system of algebraic equations and inequations over the real algebraic numbers. Consider $2 (\deg P + \deg Q)$ variables $x_1,\ldo...
III is $(0+1)^* (0+ \epsilon)$ which means pick a word from $\Sigma^*$ where $\Sigma = \{0, 1 \}$ and then concatenate it with either $0$ or $\epsilon$. so III Does generate a string with two consecutive $1$'s. In fact it generates every string which contains $1$'s, $0$'s or is empty.
One can reduce your problem to the following. Given a sequence of $N$ numbers, find a contiguous subsequence of length at most $K+1$ having maximal sum. This problem, in turn, is solvable in time $O(N)$. What's the connection between your problem and mine? Let the positions of the mistakes be $I_1,\ldots,I_t$, and a...
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?
Formulating a linear program s.t. only extreme point solutions are found
|linear-programming|
Perturb the vector of the objective function slightly. If you got multiple optimal solutions than this vector is orthogonal to a facet $F$ of the polytope that defines the feasible area of the LP. Notice that $F$ could be an edge, but also a higher dimensional flat. By changing the objective function slightly you will ...
1. Your solution is valid and follows definition of *d*-ary heap. But as you pointed out your notation is a bit sophisticated. You might use those two following functions to retrieve parent of *i*-th element and *j*-th child of *i*-th element. $\text{d-ary-parent}({\it i}) \\ \ \ \ \ {\bf return}\ \lfloor (i...