instruction
stringlengths
0
29.8k
⌀
If you don't care too much about accuracy, FLOPS and OPS are roughly equivalent. If you do care, then neither FLOPS nor OPS are precise enough.
The recurrences of the form $$T(n)=T(n-1)+f(n),\\T(0)=T_0$$ are solved by $$T(n)=T_0+\sum_{k=1}^n f(n)$$ as you can check by induction. (Because $T(n)=T(n-1)+f(n)=T(n-2)+f(n-1)+f(n)=T(n-3)+f(n-2)+f(n-1)+f(n)=\cdots$.)
The recurrences of the form $$T(n)=T(n-1)+f(n),\\T(0)=T_0$$ are solved by $$T(n)=T_0+\sum_{k=1}^n f(n)$$ as you can check by induction. (Because $T(n)=T(n-1)+f(n)=T(n-2)+f(n-1)+f(n)=T(n-3)+f(n-2)+f(n-1)+f(n)=\cdots$.) ---------- From the above formula, we can obtain the asymptotic expression in an emp...
null
null
In my planar_graph_playground repo undirected_graph.js function [planar_face_traversal(G, ptfv)][1] traverses all faces of embedded graph G, and calls all functions passed in planar face traversal visitor "ptfv". "is_embedding(G)" is a nice simple example using above function: function is_embedding(G) { ...
null
Is a computer with infinite memory and infinite word size a Turing machine equivalent (in the sense that polynomial time remains polynomial time and exponential time remains exponential time) if we allow constant-time linked list element insertion (at the beginning of the list)? I doubt this because element insertio...
I am trying to understand what the time complexity for an autocomplete function for a Trie-based dictionary would be. Every node contains a letter and whether it is the last letter of a word, and if so, how frequently it shows up in the english language. From my understanding, if we have a Trie (prefix tree), and we...
Time complexity of Trie autocompletion (multiple variables in time complexity)
|complexity-theory|time-complexity|asymptotics|trees|
null
null
In the [PBFT paper written by Miguel Castro][1] it has been mentioned: (In Abstract:) > "BFT has been implemented as a generic program library with a simple > interface." (Also in page 71:) > "The algorithm has been implemented as a generic program library with > a simple interface. Thelibrary can be used...
Where is found the original library of the PBFT consensus algorithm?
|algorithms|distributed-systems|consensus|byzantine|
null
null
This is a pretty vague question and can be applied to many math problems not just recurrence relations. [![enter image description here][1]][1] Above I fully understand, setting up the recurrence relation from the algorithm given. And how the next step would be plugging and chugging to find a pattern that we can ...
Recurence Relation, specifically understanding substitution rule used
|algorithm-analysis|recurrence-relation|
null
I believe [this link on the Internet Archive][1] is the earliest available snapshot of the webpage that contains links to the [requested source code][2]. [1]: https://web.archive.org/web/20031002114315/http://www.pmg.lcs.mit.edu/bft/ [2]: https://web.archive.org/web/20031002114315/http://pmg.lcs.mit.edu/~rod...
null
null
Consider an array A[1..n] that first rises monotonically up to some point p then it monotonically decreases until some point q and then rises again. That is A[k] < A[k + 1] for all k in [1..p] and [q..n] and A[k] > A[k + 1] if p < k < q. Suppose we are searching for the element A[p] or the index p, is it possible t...
Search for largest element in 1st monotonic subarray with an array consisting of 3 monotonic subarrays
|algorithms|algorithm-analysis|search-algorithms|
No. It can't be done in sublinear time. I'll prove that any algorithm whose worst-case running time is $n/3-1$ or less, must be incorrect on some input. It follows that every correct algorithm has worst-case running time at least $n/3$, i.e., at least linear. Consider any deterministic algorithm whose worst-case ...
null
I don't know exactly what the question is. Plugging in is mainly used to see the pattern, in your case you might have noted that $M(1)=1$, $M(2)=2$, and so on. If you want to prove that $M(n)=n$, it's easiest to proceed with induction. The base case is already stated in your first figure and the inductive step isn't...
null
Prove or give a counterexample: for every function f from non-negative integers to non-negative reals, o(f) = O(f) − Θ(f). Here “−” denotes the set minus operation. I try to make some tryout but failed to make the abstract function f to into working, can someone give me some Hints or solutions?
Prove or give a counterexample of o(f) = O(f) − Θ(f)
|algorithms|algorithm-analysis|
Consider $f(n) = n^2$ and $g(n) = \left\{\begin{array}{ll}n & \text{if }n\text{ is even}\\n^2&\text{otherwise}\end{array}\right.$.
When I was trying to solve a problem, I met another problem like this: Given a undirected connected graph $G=(V,E)(V\le100)$ and some subgraphs of $G$: $G_1,G_2,\cdots,G_n(n\le 32)$. We need to cut some edges in $G$ so that **neither** of the subgraphs $G_1,G_2,\cdots,G_n$ is a connected graph. I have tried many...
A problem about min-cut
|algorithms|graphs|network-flow|
When I was trying to solve a problem, I met another problem like this: Given a undirected connected graph $G=(V,E)(|V|\le100)$ and some subgraphs of $G$: $G_1,G_2,\cdots,G_n(n\le 32)$, and all $G_i$ is connected and **include all the vertexs in $G$.** We need to cut some edges in $G$ so that **neither** of the subgr...
When I was trying to solve a problem, I met another problem like this: Given a undirected connected graph $G=(V,E)(|V|\le100)$ and some subgraphs of $G$: $G_1,G_2,\cdots,G_n(n\le 32)$, and all $G_i$ is connected and **include all the vertexs in $G$.** We need to cut some edges in $G$ so that **neither** of the subgr...
When I was trying to solve a problem, I met another problem like this: Given a undirected connected graph $G=(V,E)(|V|\le100)$ and some subgraphs of $G$: $G_1,G_2,\cdots,G_n(n\le 32)$, and all $G_i$ is connected and **include all the vertexs in $G$.** We need to cut some edges in $G$ so that **neither** of the subgr...
A problem about min-cut on subgraphs
null
null
I need to propose an algorithm for a NP-hard problem. I use dynamic programming which leads to a running time $O(2^s\cdot n^2), s\leq n.$ The algorithm aims to finding a path in a graph $G(V, E)$ (in which each of the n nodes is colored in one of the $s$ colors) containing all the $s$ colors which are represented a sin...
Running time of SAT and other EXPTIME algorithms
|time-complexity|np-complete|satisfiability|
Let's say I have a 60 set of numbers from **0-100,000** so like `[81, 98, 115, 189, 254, ... , 97866, 98441, 99671]` all unique and progressively increasing. Would it be mathematically possible to compress this sequence by 80-90%? so far I've tried gzip which only compresses at 50% and other algorithms the best one I f...
is it possible to compress a sequence of progressive unique numbers dramatically?
|data-compression|
Let's say I have a 60 set of numbers from **0-100,000** so like `[81, 98, 115, 189, 254, ... , 97866, 98441, 99671]` all unique and progressively increasing. Would it be mathematically possible to compress this sequence by 80-90%? so far I've tried gzip which only compresses at 50% and other algorithms the best one I f...
null
From a counting point of view, there are $\binom{100000}{60}$ such sequences and so, numbering them, you could theoritically compress it down to $\log_2\binom{100000}{60}$ bits but not further. This is roughly equal to 1 Kilobit.
null
What is the asymptotic runtime of ${n \choose 3} \log ^4n$ ? I know that ${n \choose 3}$ is in $\cal O (n^3)$, but what about the term $log^4n$ and what about the product of the two?
What is the asymptotic runtime of the below equation?
|asymptotics|big-o-notation|
I need to propose an algorithm for a NP-hard problem. I use dynamic programming which leads to a running time $O(2^s\cdot n^2), s\leq n.$ The algorithm aims to finding a path in a graph $G(V, E)$ (in which each of the n nodes is colored in one of the $s$ colors) containing all the $s$ colors which are represented a sin...
You have the definition of EXPTIME wrong. The definition refers to the length of the input. Neither $s$ nor $n$ are the length of the input. The definition of EXPTIME says that the running time is $O^{p(\ell)}$ where $\ell$ is the length of the input. A challenge for you: What is the length of the input, in terms...
From a counting point of view, there are $\binom{100000}{60}$ such sequences and so, numbering them, you could theoritically compress it down to $\log_2\binom{100000}{60}$ bits but not further. This is roughly equal to 1 Kilobit or 125 octets.
null
I need to propose an algorithm for a NP-hard problem. I use dynamic programming which leads to a running time $O(2^s\cdot n^2), s\leq n.$ The algorithm aims to finding a path in a graph $G(V, E)$ (in which each of the n nodes is colored in one of the $s$ colors) containing all the $s$ colors which are represented a sin...
Sorting step is necessary however like you mentioned, it can be sorted in ascending order too. Just that the traversal will have to be from end to beginning then (instead of descending sort which has beginning to end traversal)
null
You can use the min-cost max-flow algorithm to solve this more efficiently. (The Ford Fulkerson algorithm is only changed slightly to achieve this for DAGs). In your graph construction, instead of adding edges from a dummy source to all "source-vertices" on the original graph, add them to all vertices instead; do the ...
What is the asymptotic of ${n \choose 3} \log ^4n$ ? I know that ${n \choose 3}$ is in $\cal O (n^3)$, but what about the term $log^4n$ and what about the product of the two?
null
null
Let's say I have a 60 set of numbers from **0-100,000** so like `[81, 98, 115, 189, 254, ... , 97866, 98441, 99671]` all unique and progressively increasing. Would it be mathematically possible to compress this sequence by 80-90%? so far I've tried gzip which only compresses at 50% and other algorithms the best one I f...
null
null
In classical kD-trees, the splitting dimension is chosen using a simple and systematic rule: dimensions are taken in a round-robin fashion. But extra freedom is available because you could very well choose the splitting dimension at will on every level, and even differently on every node. Has this been investigat...
Adaptive kD-trees
|computational-geometry|kd-tree|
null
What is known about the languages: $$S_f = \{ [M] \ | \ \exists{x} \ \text{s.t.} \\ M \ \text{accepts} \ x \ \text{in} \ f(|[M]|) \ \text{steps}, \\ \ |x| \leq f(|[M]|) \}$$ I used to think that in order to check appartenance to $S_f$ you cannot avoid simulating $M$ on all possible $x$ whose length is less than $...
Set of Turing machines that accepts at least one input in bounded time
|complexity-theory|time-complexity|turing-machines|p-vs-np|
What is known about the languages: $$S_f = \{ [M] \ | \ \exists{x} \ \text{s.t.} \\ M \ \text{accepts} \ x \ \text{in} \ f(|[M]|) \ \text{steps}, \\ \ |x| \leq f(|[M]|) \}$$ I used to think that in order to check appartenance to $S_f$ you cannot avoid simulating $M$ on all possible $x$ whose length is less than $...
Checking if two polygons intersect is equivalent to checking if a point lies inside their Minkwoski sum. Illustration with a triangle: [![enter image description here][1]][1] The Minkowki sum of a polygon and a convex hexagon is found in linear time in the number of vertices (see http://acg.cs.tau.ac.il/courses/alg...
Checking if two polygons intersect is equivalent to checking if a point lies inside their Minkwoski sum. Illustration with a triangle: [![enter image description here][1]][1] The Minkowki sum of a polygon and a convex hexagon is found in linear time in the number of vertices (see http://acg.cs.tau.ac.il/courses/alg...
Checking if two polygons intersect is equivalent to checking if a point lies inside their Minkwoski sum. Illustration with a triangle: [![enter image description here][1]][1] The Minkowki sum of a polygon and a convex hexagon is found in linear time in the number of vertices (see http://acg.cs.tau.ac.il/courses/alg...
In classical kD-trees, the splitting dimension is chosen using a simple and systematic rule: dimensions are taken in a round-robin fashion. But extra freedom is available because you could very well choose the splitting dimension at will on every level, and even differently on every node. Has this been investigat...
As described [here][1] the Takagi factorization of a square symmetric complex matrix $A=VDV^T$ where D is a real nonnegative diagonal matrix, and V is unitary. I'm wondering what the complexity of calculating this is for a $n\times n$ matrix? I would think $O(n^{2.8074})$, if using Strassen's matrix multiplication alg...
Complexity of calculating Takagi's factorization of $n \times n$ matrix
|matrices|linear-algebra|
Let us establish a product rule. Assume that $F(n)=O(f(n))$ and $G(n)=O(g(n))$. This means that $$\exists N_f,c_f:\forall n\ge N_f: F(n)\le c_f f(n),$$ $$\exists N_g,c_g:\forall n\ge N_g: G(n)\le c_g g(n).$$ From this we draw that, with $N=\max(N_f,N_g)$ and $c=c_fc_g$ $$\exists N,c:\forall n\ge N: F(n)G(n...
$$M(n)=M(n-1)+1$$ can be written $$M(k)=M(k-1)+1$$ or with any other expression as the argument. E.g. $$M(n-1)=M(n-1-1)+1.$$ By combining, $$M(n)=M(n-1-1)+1+1.$$ Repeating, $$M(n)=M(n-1-1-\cdots1)+1+1+\cdots1.$$
$$M(n)=M(n-1)+1$$ can be written $$M(k)=M(k-1)+1$$ or with any other expression as the argument. E.g. $$M(n-1)=M(n-1-1)+1.$$ By combining, $$M(n)=M(n-1)+1=M(n-1-1)+1+1.$$ Repeating, $$M(n)=M(n-1-1-\cdots1)+1+1+\cdots1.$$ In the end, >!$$M(n)=M(0)+n.$$
N over 3 is O(n^3), and log^4(n) is log^4(n). The whole formula is O(n^3 log^4 n). That’s it. Can’t be simplified any further.
N over 3 is O(n^3), and log^4(n) is log^4(n). The whole formula is O(n^3 log^4 n). That’s it. Can’t be simplified any further. It’s asymptotically less than O(n^(3+eps)) for any eps > 0, or less than O(n^3 log^(4+eps) n) or O(n^3 log^4 n log log log n).
I'm trying to understand this paper: https://www.sciencedirect.com/science/article/pii/0304397594901856 I don't understand this part: Lemma 2.11: HC-3-regular-(n-even) is NP-complete The result is obvious since the number of edges of a 3-regular graph is (3/2) n. The paper says that it is proved th...
A 3-regular graph with an even number of vertices is planar?
|graphs|planar-graphs|
From a counting point of view, there are $\binom{100000}{60}$ such sequences and so, numbering them, you could theoritically compress it down to $\log_2\binom{100000}{60}$ bits but not further. This is roughly equal to 90 octets.
I'm trying to understand this paper: https://www.sciencedirect.com/science/article/pii/0304397594901856 I don't understand this part: Lemma 2.11: HC-3-regular-(n-even) is NP-complete The result is obvious since the number of edges of a 3-regular graph is (3/2) n. I don't understand what is the rela...
I have a flow question which I'm stumped on but seems like there should be an answer that I am not seeing. Consider a network with a start $s$ and an end $t$ and a bipartite graph $L \cup R$. $s$ is connected to all vertices in $L$ via edges with capacity $1$. All vertices in $R$ are connected to $t$ via edges with...
Max flow in bipartite network where all vertices on the left hand side have degree exactly $2$
|algorithms|graphs|network-flow|minimum-cuts|