instruction
stringlengths
0
29.8k
⌀
|algorithms|reference-request|strings|string-metrics|substrings|
What would the order of growth for this loop be: int sum = 0; for (int n = N; n > 0; n /= 2) for(int i = 0; i < n; i++) sum++; The first loop seems to run for logN + 1 times and the second loop runs n times. so is the correct answer O(nlogn) ?
The order of growth analysis of simple for loop
|asymptotics|
I would like to ask how to determine the number of states when designing a Turing machine from the description for a language? For example: L = {wcw|w belongs to {0,1}*} I mean how to know how many states are there in the set Q, with the information from the description of that language. I'm really appreciated ...
How to calculate the number of states in designing TURING machine?
|complexity-theory|formal-languages|
I would like to ask how to determine the number of states when designing a Turing machine from the description for a language? For example: $\qquad \displaystyle L = \{wcw \mid w \in \{0,1\}^*\}$ I mean how to know how many states are there in the set Q, with the information from the description of that language....
|formal-languages|turing-machines|descriptive-complexity|
null
$\mathcal{O}(g)$ (read Big oh of $g$) is a formalization of the idea that a function becomes nearly proportional to another one as we evaluate it at large values. Take for example the function $f(n) = 1000 + n + n^2$. For small values of $n$, most of the cost is coming from the constant $1000$; as $n$ becomes larger, t...
That's correct. By definition, $log_b$ is the number of times you divide by $b$ to get to $1$ (to get to $1$ you divide $4$ by $2$ twice so $log_2 4 = 2$). In your case $b=2$. The second loop is a executed $n$ times obviously so the total running time is $\Theta(nlg n)$ ($lg n = log_2 n$).
null
That's correct. By definition, $\log_b$ is the number of times you divide by $b$ to get to $1$ (to get to $1$ you divide $4$ by $2$ twice so $\log_2 4 = 2$). In your case $b=2$. The second loop is a executed $n$ times obviously so the total running time is $\Theta(n \log_2 n)$.
What would the order of growth for this loop be: int sum = 0; for (int n = N; n > 0; n /= 2) for(int i = 0; i < n; i++) sum++; The first loop seems to run for $\log N + 1$ times and the second loop runs $n$ times. So is the correct answer $O(n \log n)$?
I would like to ask how to determine the number of states when designing a Turing machine from the description for a language? For example: $\qquad \displaystyle L = \{wcw \mid w \in \{0,1\}^*\}.$ I mean how to know how many states are there in the set $Q$, with the information from the description of that langua...
How to calculate the number of states in designing a Turing machine?
How is the rule 110 Turing complete?
A surprising number of problems have fairly natural reductions to linear programming problems. See [this chapter][1] for examples of network flows, bipartite matching, zero-sum games, shortest paths, a form of linear regression, and even circuit evaluation! Since circuit evaluation reduces to linear programming, an...
Sorting as a linear program
|algorithms|linear-programming|
I have a recommender system framework which is implemented with a variant on Funk SVD. However the framework that they are trying to integrate doesn't support Funk SVD, only SGD. Since shouldn't these be compatible? In other words, I should be able to create the U and V matrices with SGD and then treat them like they w...
Using Funk SVD with SGD?
|matrices|
Below is an expected $\mathcal{O}(n + m )$ algorithm (which can be extended to other $k$, making it $\mathcal{O}(nk +m )$). (I haven't done the calculations to prove it is so, though). The idea is similar to the [Robin-Karp rolling hash][1] algorithm for exact substring matches. The idea is to separate each strin...
I have a recommender system framework which is implemented with a variant on Funk SVD. However the framework that they are trying to integrate doesn't support Funk SVD, only SGD. Since shouldn't these be compatible? In other words, I should be able to create the U and V matrices with SGD and then treat them like they w...
Below is an expected $\mathcal{O}(n + m )$ algorithm (which can be extended to other $k$, making it $\mathcal{O}(nk +m )$). (I haven't done the calculations to prove it is so, though). The idea is similar to the [Robin-Karp rolling hash][1] algorithm for exact substring matches. The idea is to separate each strin...
If you restate the problem in a slightly different (but equivalent) way, an algorithm becomes more obvious: There are $n$ parties involved: $n-1$ persons, and one restauarant. Let $p_i$ be the amount of money party $i$ should have **after** the meal is finished and paid for. For example, if Alice has \$36 and owes...
simon funk is the apparent inventor of a simple & ingenious SVD (singular value decomposition) algorithm during the [netflix contest](http://www.sigkdd.org/explorations/issues/9-1-2007-06/simon-funk-explorations.pdf) although the algorithm may have predated his discovery (would like to know a ref if anyone knows). SGD ...
simon funk is the apparent inventor of a simple & ingenious SVD (singular value decomposition) algorithm during the [netflix contest](http://www.sigkdd.org/explorations/issues/9-1-2007-06/simon-funk-explorations.pdf) although the algorithm may have predated his discovery (would like to know a ref if anyone knows). SGD ...
simon funk is the apparent inventor of a simple & ingenious SVD (singular value decomposition) algorithm during the [netflix contest](http://www.sigkdd.org/explorations/issues/9-1-2007-06/simon-funk-explorations.pdf) although the algorithm may have predated his discovery (would like to know a ref if anyone knows). SGD ...
Below is an expected $\mathcal{O}(n + m )$ algorithm (which can be extended to other $k$, making it $\mathcal{O}(nk +m )$). (I haven't done the calculations to prove it is so, though). The idea is similar to the [Rabin-Karp rolling hash][1] algorithm for exact substring matches. The idea is to separate each strin...
I´m not exactly sure what kind of impact these two things have on kernel design. Are servers more flexible because of running in user space, for instance, and does adding a module require a new build of a kernel? Also first time using Stack Exchange, doing my best to stick to a good format.
What is the difference between a module in a monolithic kernel and a server in a microkernel?
|os-kernel|
null
I am trying to derive the <a href="http://alexandria.tue.nl/repository/freearticles/597601.pdf">classic paper</a> in the title only by elementary means (no generating functions, no complex analysis, no Fourier analysis) although with much less precision. In short, I "only" want to prove that the average height $h_n$ of...
I have recently started with Machine Learning. I think that Stanford ML course by Andrew Ng is great place to start: academicearth.org/courses/machine-learning/ (or on Coursera). I'm particularly interested in **Support Vector Machines**. I'm planning to use SVM for my thesis because I'm CS senior student. I'm l...
null
Let's assume that $N=2^{k}$. The first loop runs $\log_2N$ times. the second loop depends on the value of $n$ in the first. When $n=N$, the second loop runs $N$ times, when $N$ is halved it runs $\frac{N}{2}$ times and so on. The second loop runs in total: $N + \frac{N}{2} + \frac{N}{4} + \dots +1=N(1+\frac{1}{2}+\frac...
Let's assume that $N=2^{k}$. The first loop runs $\log_2N$ times. the second loop depends on the value of $n$ in the first. When $n=N$, the second loop runs $N$ times, when $N$ is halved it runs $\frac{N}{2}$ times and so on. The second loop runs in total: $N + \frac{N}{2} + \frac{N}{4} + \dots +1=N(1+\frac{1}{2}+\frac...
The first loop runs $\log_2N$ times but in nested loops we are interested in the running time of the inner loop (thanks to Tsuyoshi Ito for the clarification). The second loop depends on the value of $n$ in the first. When $n=N$, the second loop runs $N$ times, when $N$ is halved it runs $\frac{N}{2}$ times and so on. ...
When people are interviewed following a *random* arrival order, the probability of candidate $i$ being hired is $\frac{1}{i}$. This follows from the fact that, assuming a random order of arrivals, for each $i$ the group of initial $i$ candidates is random, so that the $i$-th candidate has probability $\frac{1}{i}$ of b...
null
a leading implementation of the superposition calculus theorem prover is E. in its [description of their technology](http://www4.informatik.tu-muenchen.de/~schulz/E/Technology.html) it states some basic theory & background under **Proof Procedure**: > E uses the DISCOUNT [DKS97] variant of the given-clause algori...
I'm working out of the 3rd edition CLRS Algorithms textbook and in Chapter 3 a discussion begins about asymptotic notation which starts with $\Theta$ notation. I understoof the beginning definition of: $\Theta$(g(n)) = { f(n): there exist positive constants $c_1$, $c_2$, and $n_0$ such that 0 $\leq$ $c_1$ g(n) $\leq...
Deeper understanding of Theta Definition (CLRS 3rd Edition Text)
|complexity-theory|asymptotics|
a leading implementation of the superposition calculus theorem prover is E. in its [description of their technology](http://www4.informatik.tu-muenchen.de/~schulz/E/Technology.html) it states some basic theory & background under **Proof Procedure**: > E uses the DISCOUNT [DKS97] variant of the given-clause algorith...
I have a recommender system framework which is implemented with a variant on Funk SVD. However the framework that they are trying to integrate doesn't support Funk SVD, only SGD. Since shouldn't these be compatible? In other words, I should be able to create the U and V matrices with SGD and then treat them like they w...
|algorithms|machine-learning|matrices|
a leading implementation of the superposition calculus theorem prover is E. in its [description of their technology](http://www4.informatik.tu-muenchen.de/~schulz/E/Technology.html) it states some basic theory & background under **Proof Procedure**: > E uses the DISCOUNT [DKS97] variant of the given-clause algorith...
A surprising number of problems have fairly natural reductions to linear programming problems. See [Chapter 7][1] of \[1\] for examples of network flows, bipartite matching, zero-sum games, shortest paths, a form of linear regression, and even circuit evaluation! Since circuit evaluation reduces to linear programmi...
|algorithms|sorting|linear-programming|
I´m not exactly sure what kind of impact these two things have on kernel design. Are servers more flexible because of running in user space, for instance, and does adding a module require a new build of a kernel?
|operating-systems|os-kernel|
When the iterations of the inner loop depend on the outer loop, it's better to sum over the amount of iterations of the inner loop. Iterations ---------- In this example, we can see that the inner loop performs: - $n$ iterations - $\frac{n}{2}$ iterations - $\frac{n}{4}$ iterations - $\dots$ - $\frac...
When the iterations of the inner loop depend on the outer loop, it's better to sum over the amount of iterations of the inner loop. There is no need to overcomplicate this and think of logarithms just because the outer loop has logarithmic behavior. Iterations ---------- In this example, we can see that the inne...
I'm working out of the 3rd edition CLRS Algorithms textbook and in Chapter 3 a discussion begins about asymptotic notation which starts with $\Theta$ notation. I understood the beginning definition of: $\Theta$(g(n)) = { f(n): there exist positive constants $c_1$, $c_2$, and $n_0$ such that 0 $\leq$ $c_1$ g(n) $\leq...
I have a recommender system framework which is implemented with a variant on Funk SVD (See his explanation of his algorithm [here][1]). However the framework that they are trying to integrate doesn't support Funk SVD, only SGD ([Stochastic Gradient Descent][2]). Since shouldn't these be compatible? In other wor...
I work on a recommender system framework which is implemented with a variant on Funk SVD (See his explanation of his algorithm [here][1]). However the framework that we are trying to integrate doesn't support Funk SVD, only SGD ([Stochastic Gradient Descent][2]). Since shouldn't these be compatible? In other wo...
null
Successful applications of fuzzy logic to reasoning in AI?
This is just a technicality. In asymptotic analysis we are only "really" interested in positive functions like $n^3$ or $n\log n$. However, if we want to be very formal and general, we could take into account non-positive functions (and that could turn it to be useful, see below). The definition of $\Theta$ states that...
What is a good textbook for a seminar about virtual environments, virtual worlds, augmented reality and similar topics? Ideally with a creative commons license and available online.
A text for virtual environments seminar
|books|graphics|user-interface|hci|computer-games|
When the iterations of the inner loop depend on the outer loop, it's better to sum over the amount of iterations of the inner loop. There is no need to overcomplicate this and think of logarithms just because the outer loop has logarithmic behavior. Iterations ---------- In this example, we can see the number of...
I'm working out of the 3rd edition CLRS Algorithms textbook and in Chapter 3 a discussion begins about asymptotic notation which starts with $\Theta$ notation. I understood the beginning definition of: $$\Theta(g(n)) = \{ f(n)\,|\, \exists\, c_1, c_2, n_0: 0 \leq c_1 g(n) \leq f(n) \leq c_2 g(n)\ \ \forall n \geq n_...
null
|reference-request|books|graphics|computer-games|hci|
I'm working out of the 3rd edition CLRS Algorithms textbook and in Chapter 3 a discussion begins about asymptotic notation which starts with $\Theta$ notation. I understood the beginning definition of: $$\Theta(g(n)) = \{ f(n)\,|\, \exists\, c_1, c_2 > 0, n_0 \in \mathbb{N}: 0 \leq c_1 g(n) \leq f(n) \leq c_2 g(n)\ ...
null
Definition of $\Theta$ for negative functions
|terminology|asymptotics|
## Why $\Theta(g)$ may be empty ## It follows directly from the definition. $$\Theta(g(n)) = \{ f(n)\,|\, \exists\, c_1, c_2 > 0, n_0 \in \mathbb{N}: 0 \leq c_1 g(n) \leq f(n) \leq c_2 g(n)\ \ \forall n \geq n_0\}$$ The important part here is this: $ f(n) | \exists\, c_1 > 0: 0 \leq c_1 g(n)$ Obviously, the...
The following answer is basically equivalent to the one you already know, but may seem a bit less "magical". On the other hand, it's more technical, but I believe the general technique "write your problem as an optimization on permutation matrices and invoke Birkhoff-von Neumann" is a great one to know. For a permut...
The following answer is basically equivalent to the one you already know, but may seem a bit less "magical". On the other hand, it's more technical, but I believe the general technique "write your problem as an optimization on permutation matrices and invoke Birkhoff-von Neumann" is a great one to know. For a permut...
The following answer is basically equivalent to the one you already know, but may seem a bit less "magical". On the other hand, it's more technical, but I believe the general technique "write your problem as an optimization on permutation matrices and invoke Birkhoff-von Neumann" is a great one to know. For a permut...
null
Check out this lecture by Sam Buss on total NP search problems: http://www.newton.ac.uk/programmes/SAS/seminars/032811301.html. It discusses how to define complexity classes, reductions, and completeness for search problems which always have a solution but such a solution may be hard to find. Note, that any theorist...
There is a theorem of Whitney answering your question. Let $$ P(G,\lambda) = \sum_{k=0}^n (-1)^k a_k \lambda^{n-k}. $$ Then $a_k$ is the number of $k$-subsets of the edges of $G$ not containing any *broken cycle*. A broken cycle of $G$ is obtained from a cycle of $G$ by removing its maximum edge according to some fix...
I want to filter efficiently a list of integers for duplicates in a way that only the resulting set needs to be stored. One way this can be seen: - we have a range of integers $S = \{1, \dots{}, N\}$ with $N$ big (say $2^{40}$) - we have a function $f : S \to S$ with, supposedly, many collisions (the images ...
**Planar 3SAT** is NP-complete. A planar 3SAT instance is a 3SAT instance for which the graph built using the following rules is planar: 1. add a vertex for every $x_i$ and $\bar{x_i}$ 2. add a vertex for every clause $C_j$ 3. add an edge for every $(x_i,\bar{x_i})$ pair 4. add an edge from vertex $x_i$ (or $\bar...
Planarity conditions for Planar 1-in-3 SAT
|3-sat|
If there is a Turing machine that can computes a given language, which in your case there is, then there must be at least one such machine, which the number of its states are no more than any other alike TM, i.e. You may ask what is the minimal TM (with minimum number of states) which could accept a given language. As ...
If there is a Turing machine that can compute a given language at all, which in your case there is, then there must be at least one such machine, which the number of its states are no more than any other alike TM, i.e. You may always ask what is the minimal TM (with minimum number of states) which could accept a given ...
null
I think that given a decidable language $L$, you can always build a *2-states* TM that recognizes it. Indeed there exists a 2 state Universal Turing Machine $UTM_{2U}$ (with alphabet $|\Sigma| \geq 18$). If $TM_i$ decides $L$ then $UTM_{2U}(i,x)$ decides $L$; so you can build a 2-states $TM_{2L}$ hard encoding $i...
it has been known since Shannon 1956 that "small" (in either states or alphabets) universal Turing machines exist and there is a long history of their study, see [1] for a survey. this implies that any Turing machine can be converted to those universal Turing machines as Vor sketches out in his answer as an example. th...
null
I think that given a decidable language $L$, you can always build a *2-states* TM that recognizes it. Indeed there exists a 2 state Universal Turing Machine $UTM_{2U}$ (with alphabet $|\Sigma| \geq 18$). If $TM_i$ decides $L$ then $UTM_{2U}(i,x)$ decides $L$; so you can build a 2-states $TM_{2L}$ hard encoding $i...
null
null
[NTP](http://en.wikipedia.org/wiki/Network_Time_Protocol) actually uses 4 time measurements $t_0, t_1, t_2, t_3$ to compute the "offset". they are the "time points" in the round trip of the packet from client to server back to client but can be regarded as time offsets. its assumed that the time offset can be off betwe...
Yes you can. Actually you can even show that something stronger is true. The problem know as **Positive Planar 1-in-3-SAT** is NP-complete as shown by [Mulzer and Rote](http://arxiv.org/pdf/cs/0601002v3.pdf). In this version of 1-in-3-SAT, you require for every input formula that * you have three variables per c...