instruction
stringlengths
0
29.8k
⌀
For one of the loops, you've a complexity of `O(sqrt(n))`. You're nesting the loops three times, so you'll get the complexity of `O(sqrt(n)^3)`, which is `O(n^(3/2))`. If you want to be more precise, then for your original question, the complexity will be: 1. `O(sqrt(n))` for the first loop 2. `O(sqrt(n) - 1)` f...
I have seen this function in past year exam paper. public static void run(int n){ for(int i = 1 ; i * i < n ; i++){ for(int j = i ; j * j < n ; j++){ for(int k = j ; k * k < n ; k++){ } } } } After give some example, I gu...
What is the time complexity of this function?
|time-complexity|
The key is that sorting is in NC. The following works: 1. Sort both relations by the relevant attribute 2. Find the max and min (both possible in NC) and partition the data. If you have $p^k$ processors joining $n$ tuples, each will join $\log n$. Each processor can find the beginning of its range by using a binary...
Your program is correct. Your could also iterate `Math.Log(n)*Math.Log(n)*Math.Log(n)` times. Not sure if that is considered cheating.
I'm learning Data Structures and Algorithms now, I have a practical question that asked to write a function with O(log<sup>3</sup>n), which means log(n)*log(n)*log(n). public void run(int n) { for (int i = 1; i < n; i *= 2) { for (int j = 1; j < n; j *= 2) { for (int k = 1; k < n; k *= 2) { Sys...
What is the time complexity of the function?
|time-complexity|
Attempt to write a function with cubed log runtime complexity $O(\log^3 n)$
Time complexity of a triple nested loop with squared indices
For one of the loops, you've a complexity of $O(\sqrt n)$. You're nesting the loops three times, so you'll get the complexity of $O(\sqrt n^3)$, which is $O(n^{3/2})$. If you want to be more precise, then for your original question, the complexity will be: 1. $O(\sqrt n)$ for the first loop 2. $O(\sqrt n - 1)$ f...
{"Voters":[{"Id":1590,"DisplayName":"Xodarap"}]}
null
(I assume by "error propagation" you mean what I call "error *back*-propagation.") On page 231 of Neural Networks (by Haykin), he states that back propagation always converges, although the rate can be (in his words) "excruciatingly slow." I think what you are asking though is not whether the algorithm will alway...
I'm just going off that description you linked to, but what about a BST? You might be able to construct it to balance out unsolved nodes. That could save you time on step 2, and would help keep the overall time down depending on the number of traversals. Of course, if you balanced/sorted your tree according to unsol...
>Given two sets $A$ and $B$ each containing $n$ disjoint points in the plane, computes the shortest distance between a point in $A$ and a point in $B$, i.e., $min \space \left \{ dist(p; q) | p \in A; q \in B\right \} $ I am not sure if I am right, but this problem very similar to problems that can be solved by Lin...
Shortest distance between a point in A and a point in B
|algorithms|computational-geometry|
I have a solution which may seem a bit convoluted, but should be more efficient than the naive $\mathcal O(n^2)$ brute-force search: 1. let $v$ be the axis between the centres of mass of $A$ and $B$. 2. Sort the points in $A$ and $B$ along this axis in descending and ascending order respectively, resulting in the...
[Wikipedia](https://en.wikipedia.org/wiki/Side_channel_attack) defines *side-channel attacks* as: >any attack based on information gained from the physical implementation of a cryptosystem Usually in side channel attacks the implementations leak information (e.g., timing attack: the implementation leaks the time it...
Are tamper attacks considered side-channel?
|terminology|cryptography|
A tampering attack can be considered as an _active_ side-channel attack, which is one that involves (physically) interacting with the device under attack. In contrast, _passive_ attacks involve only measurement and observation. Generally, however, I think tampering attacks are considered as a separate class as the c...
I have a solution which may seem a bit convoluted, but should be more efficient than the naive $\mathcal O(n^2)$ brute-force search: 1. let $v$ be the axis between the centres of mass of $A$ and $B$. 2. Sort the points in $A$ and $B$ along this axis in descending and ascending order respectively, resulting in the...
null
The condition that $y$ has length at least one is to avoid a triviality. If you allow the length of $y$ to be zero then for **any** language you can divide each word in the language into $xyz$, such that $xy^iz$ is still in the language; choosing an empty $y$ means $xyz = xy^iz$ for any $i$. Thus the ability for a l...
The following trivially is in the complexity class $O(\log^3 n)$: public void run (int n) { return; }
The following trivially is in the complexity class $O(\log^3 n)$: public void run (int n) { return; } But here is a $\Theta(\log^3 n)$ solution: // O(log(n)), n = |orderedVals| int findClosest (int needle, int[] orderedVals) { // binary search for closest value and return it ...
I have the perfect place for you, i really enjoyed it myself. http://www.infocobuild.com/education/learn-through-videos/mathematics/discrete-mathematics.html Everything i learned is from that site.
The following trivially is in the complexity class $O(\log^3 n)$: public void run (int n) { return; } But here is a solution with average and worst case of $O(\log^3 n)$: // O(log(n)), n = |orderedVals| int findClosest (int needle, int[] orderedVals) { // binary search for cl...
>Given two sets $A$ and $B$ each containing $n$ disjoint points in the plane, compute the shortest distance between a point in $A$ and a point in $B$, i.e., $\min \space \{\mbox{ } \text{dist}(p, q) \mbox{ } | \mbox{ } p \in A \land q \in B \space \} $. I am not sure if I am right, but this problem very similar to ...
I am guessing that this is correct for `3-EXP`, `4-EXP` etc... Basically I should find a problem in `2-EXP` that is not in `EXP`. Any examples ?
How to prove 2-EXP != EXP
|complexity-theory|
I have the perfect place for you, I really enjoyed it myself: [Discrete Mathematics lecture series on infocobuild](http://www.infocobuild.com/education/learn-through-videos/mathematics/discrete-mathematics.html) Everything I learned is from that site.
It is a direct consequence of the [time hierarchy theorem][1]: **Time Hierarchy Theorem**: if f and g are time-constructible functions and $f(n) \log f(n) = o(g(n))$ (e.g. $f(n) = n^2, g(n) = n^3$), then $DTIME(f(n)) \subsetneq DTIME(g(n))$ [1]: http://en.wikipedia.org/wiki/Time_hierarchy_theorem
You can adapt the "closest pair" [linesweep algorithm][1] which is $O(n\ logn)$ The only change you will have to do is to ignore pairs that belong to the same set. [1]: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=lineSweep
You can adapt the "closest pair" [linesweep algorithm][1] which is $O(n \log n)$. The only change you will have to do is to ignore pairs that belong to the same set. [1]: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=lineSweep
null
For your sketched decision algorithm to work, it is sufficient that the run-time is *majorized* by a computable function. Every linear function $n \mapsto c\cdot n$ even for non-computable c is majorized by a computable function, viz., $n \mapsto \lceil c \rceil \cdot n$. Thus the answer to the question is no: a semi-d...
Take a semi-decidable problem and an algorithm that finds the positive answer in finite time. The run-time of the algorithm, restricted to inputs with a positive answer, cannot be bounded by a computable function. (Otherwise we’d know how long to wait for a positive answer. If the algorithm runs longer than that we kno...
Semi-decidable problems with linear bound
|computability|time-complexity|undecidability|
|machine-learning|neural-networks|
First, I'll assume that all elements are distinct. No amount of sequentialisations is going to tell you the shape of a tree with elements `[3,3,3,3,3]`. It is possible to reconstruct some trees with duplicate elements, of course; I don't know what nice sufficient conditions exist. Continuing on the negative results,...
> I am not sure if I am right, but this problem very similar to problems > that can be solved by linear programming in computational geometry. > However, the reduction to LP is not straightforward. Also my problem > looks related to finding the thinnest stip between two sets of points > which obviously can be solve...
If you have fixed the weights between the input and hidden units and are only modifying the hidden to output weights during training then there will be no local minima. With fixed input to hidden weights the optimization problem you are solving is similar to logistic regression but with a tanh instead of sigmoid functi...
Recipe generation is commonly used as an example application for Case Based Reasoning systems. It is even used as an example on the [Wikipedia Page](http://en.wikipedia.org/wiki/Case-based_reasoning). A google search for "case based reasoning recipes" yields numerous results.
So, in lectures about Rice's Theorem, reduction is usually used to proved the theorem. Reduction usually consists a construction of M', using a TM M which is in the form <M,w> to be simulated first, an input x to be simulated if M accepts. M' accepts if x is accepted. I really want a concrete input about <M,w> and ...
A concrete example of Rice's Theorem
|rices-theorem|
So, in lectures about Rice's Theorem, reduction is usually used to proved the theorem. Reduction usually consists a construction of M', using a TM M which is in the form <M,w> to be simulated first, an input x to be simulated if M accepts. M' accepts if x is accepted. I really want a concrete input about `<M,w>` an...
So, in lectures about Rice's Theorem, reduction is usually used to proved the theorem. Reduction usually consists a construction of M', using a TM M which is in the form <M,w> to be simulated first, an input x to be simulated if M accepts. M' accepts if x is accepted. I really want a concrete input about `<M,w>` an...
|computability|
So, in lectures about Rice's Theorem, reduction is usually used to proved the theorem. Reduction usually consists a construction of $M'$, using a TM $M$ which is in the form $\langle M,w \rangle$ to be simulated first, an input $x$ to be simulated if $M$ accepts. $M'$ accepts if x is accepted. I really want a conc...
Your "proof sketch" contains almost no information; you need to note the special reduction partner. Usually, the halting problem is reduced to deciding the given, arbitrary non-trivial encoding set $L$. If $L$ was decidable, so would be HP but we know HP is undecidable; therefore $L$ is undecidable. So there is no conc...
I have a solution which may seem a bit convoluted, but should be more efficient than the naive $\mathcal O(n^2)$ brute-force search: 1. let $v$ be the axis between the centres of mass of $A$ and $B$. 2. Sort the points in $A$ and $B$ along this axis in descending and ascending order respectively, resulting in the...
> A reduction is a transformation from an unknown but easier problem to a harder problem but already known. If the harder problem is solvable, so is the easier one. Otherwise, it's not. Your characterisation of reduction is a bit misleading. You don't start with an "easy" problem and reduce it to a "harder" problem ...
Finally I found my answer here: http://www.youtube.com/watch?v=TK8KHnUoelg A clear explanation for my struggle. But that doesn't mean the other answers are not helpful :P . They helped me to clear my misconceptions, so thanks for that.
I have a solution which may seem a bit convoluted, but should be more efficient than the naive $\mathcal O(n^2)$ brute-force search: 1. let $v$ be the axis between the centres of mass of $A$ and $B$. 2. Sort the points in $A$ and $B$ along this axis in descending and ascending order respectively, resulting in the...
In type theory judgements are often presented with the following syntax: ![enter image description here][1] My question is what is that symbol in the middle called? All the papers I've found seem to use an image rather than a unicode character so I can't look it up. I've also not found any type-theory reference w...
What is the type theory judgement symbol?
|type-theory|
It's called a "turnstile". See http://en.wikipedia.org/wiki/Turnstile_%28symbol%29.
No, you cannot bound it. Assume you have a characterization of your bound, in terms of a function. That can be a polynomial, exponential, linear etc. We will denote that function by $f(n)$. Since we work on a deterministic setting, we can define an appropriate class $DTIME(f(n))$. Here note that we get a bound on the n...
Take a semi-decidable problem and an algorithm that finds the positive answer in finite time. The run-time of the algorithm, restricted to inputs with a positive answer, cannot be bounded by a computable function. (Otherwise we’d know how long to wait for a positive answer. If the algorithm runs longer than that we kno...
null
It's called a "turnstile". See [the Wikipedia article][1]. [1]: http://en.wikipedia.org/wiki/Turnstile_%28symbol%29
null
I am reading "Efficient Cryptographic Schemes Provably as Secure as Subset Sum" by R. Impagliazzo and M. Naor ([paper](http://www.stevens.edu/algebraic/Files/SubsetSum/impagliazzo96efficient.pdf)) and came across the following statement in the proof of Theorem 3.1 (pages 10-11): > Let $\ l(n) = (1-c)n \ $ for $ \ c...
Does a collision oracle for the pigeonhole subset sum problem produce solutions?
|complexity-theory|computability|np-complete|reductions|
I have one puzzle whose answer I have boiled down to finding the total number and type of permutation they are (also). For example the string is of length 10 as **aabbbaabba** Total number of permutation will be = 10!/(frequencyof(a)! * frequencyof(b)!)) = 10!(/5!*5!) now ...
Finding the total number of permutation for a string of length N having only n chracters.Say for n = 2?
|algorithms|
Suppose we have a $(A,B,E)$ bipartite graph and a number k. Suppose that k is smaller than $|A|$ and we want to find one of those k element subsets of $A$ which covers the most points from $B$. I can only come up wirh exponential algorithms. Is this in $P$?
constrained cover on biparite graphs
|graphs|
Finally I found my answer in [this video](http://www.youtube.com/watch?v=TK8KHnUoelg) which gives a clear explanation for my struggle. But that doesn't mean the other answers are not helpful. They helped me to clear my misconceptions, so thanks for that.
Suppose we have a $(A,B,E)$ bipartite graph and a positive integer k. Suppose that k is smaller than $|A|$ and we want to find one of those k element subsets of $A$ which covers the most points from $B$. I can only come up wirh exponential algorithms. Is this in $P$?
The total number of (different) permutations of strings with $n_i$ characters of type $i$ is given by $$\frac{(\sum_i n_i)!}{\prod_i n_i!}.$$ In other words, if the length of the string is $n=n_1 + n_2 +...$, you have $\frac{n!}{n_1!n_2!n_3!\ldots}$ different permutations. Note that the formula fits your simple cas...
I am reading "Efficient Cryptographic Schemes Provably as Secure as Subset Sum" by R. Impagliazzo and M. Naor ([paper](http://www.stevens.edu/algebraic/Files/SubsetSum/impagliazzo96efficient.pdf)) and came across the following statement in the proof of Theorem 3.1 (pages 10-11): > Let $\ l(n) = (1-c)n \ $ for $ \ c...
Suppose we have a $(A,B,E)$ bipartite graph and a positive integer k. Suppose that k is smaller than $|A|$ and we want to find one of those k element subsets of $A$ which covers the most points from $B$. I can only come up wirh exponential algorithms. Is this in $P$? Also is mixed integer programming for maximal flo...
### Detexify Draw the character on [Detexify](http://detexify.kirelabs.org/classify.html) to see what (La)TeX command generates it. Oddly, I can't get Detexify to recognize this character. `\vdash` comes up eventually, but with a very bad score no matter how well I try to draw it. ### Shapecatcher Draw the ...
The way I understand it is the following. Note that for $s_1$, $f_\vec{a'}(s_1)=T$ (because the sum was $T'$ and we replaced $a_j$ with $a'_j$ and we know that $j\in s_1$. Now, they search for a collision, i.e., another $s_2$ such that $j\notin s_2$, but $f_\vec{a'}(s_2)=T$. (is there a typo there, having $T'$ ...
null
> A reduction is a transformation from an unknown but easier problem to a harder problem but already known. If the harder problem is solvable, so is the easier one. Otherwise, it's not. Your characterisation of reduction is a bit misleading. You don't start with an "easy" problem and reduce it to a "harder" problem ...
Finally I found my answer in [this video](http://www.youtube.com/watch?v=TK8KHnUoelg) which gives a clear explanation for my struggle. But that doesn't mean the other answers are not helpful. They helped me to clear my misconceptions, so thanks for that. To summary, I didn't quite understand about the reduction ...
null
Finally I found my answer in [this video](http://www.youtube.com/watch?v=TK8KHnUoelg) which gives a clear explanation for my struggle. But that doesn't mean the other answers are not helpful. They helped me to clear my misconceptions, so thanks for that. To summarize, I didn't quite understand about the reductio...
null
I have one puzzle whose answer I have boiled down to finding the total number and which type of permutation they are. For example if the string is of length ten as $w = aabbbaabba$, the total number of permutations will be $\qquad \displaystyle \frac{|w|}{|w|_a! \cdot |w|_b!} = \frac{10!}{5!\cdot 5!}$ Now had...
Finding the number of distinct permutations of length N with n different symbols
|algorithms|combinatorics|strings|word-combinatorics|