instruction stringlengths 0 29.8k ⌀ |
|---|
O(n^3) Algorithm for Maximum Weighted Cycle Cover for Undirected Complete Graph with Triangle Inequality |
|graphs| |
null |
null |
null |
null |
$O(\sum_{l=0}^{log_2n} l*2^l)$. I took the integral of the term which I think is $O(n*log(n))$ |
What is the simplified form of this big o |
|summation| |
Testing whether a number (N) is prime or not can be made very fast but it will require storage space.
If there is a central repository that stores all prime numbers found till now and if there is a webAPI that returns these numbers or one/few number(s) at a time (sequentially) then it will be very fast to test wheth... |
Testing whether a number (N) is prime or not can be made very fast but it will require storage space |
|primes| |
Let's give an upper and a lower bound:
1) Lower bound:
$$ \sum_{l=0}^{\log_2 n} l\cdot 2^l \ \geq \ \log_2n \, \cdot 2^{\log_2 n} \ = \ n \log_2 n \ , $$
so we can say that $\sum_{l=0}^{\log_2 n} l\cdot 2^l = \Omega(n\log n)$.
2) Upper bound:
\begin{align} \sum_{l=0}^{\log_2 n} l\cdot 2^l \ &\leq \ \sum_{l=0}... |
null |
null |
null |
null |
null |
If I have two CTL equations, how do I prove they're equivalent or that one implies the other?
What's the general approach? Disproving is obvious, but I am unable to figure out how to prove the equivalence of the two or an implication |
How do I prove relations of two CTL formulas? |
|logic|first-order-logic|formal-methods|linear-temporal-logic|computation-tree-logic| |
null |
null |
null |
This may seem like a simple question, but I can neither find the answer on the internet nor AI tools can give a proper answer. I was reading a book about static networks and I saw that the bisection width of the star topology is 1, but it didn't make sense to me. The definition of bisection width is given as follows: T... |
Why bisection width of star connected network is 1? |
|parallel-computing| |
null |
We'll try to construct the TM below. Given input $a^p$, our TM will accept if and only if $p$ is prime. This TM will contain an input tape and a tape for its factors, and it starts with $a^p$ on its input tape.
1. If the input is $\varepsilon$ or $a$, the TM rejects right away. (Why? Because $0$ and $1$ are not prim... |
Your algorithm is no good. It is not feasible to store all the prime numbers, or all prime numbers of a reasonable size (e.g., 1024 bits). That would require more storage than there are atoms in the universe. |
**for a=1 to m means for(a=1;a<=m;a++)**
for i=1 to n
for j=i to n
c= c+1;
I am getting the value of C is O(n^2)
i=1,j executes n times.
i=2,j executes n-1 times.
.
.
.
i=n, j executes 1 times.
So
Value of C = n+n-1 + n-2+ ..... + 1 = Sum of n natural number... |
What's the Time Complexity and Value? |
|algorithms|time-complexity| |
**for a=1 to m means for(a=1;a<=m;a++)**
for i=1 to n
for j=i to n
c= c+1;
The total no of iterations is O(n^2)
i=1,j executes n times.
i=2,j executes n-1 times.
.
.
.
i=n, j executes 1 times.
So
Total No of iterations = n+n-1 + n-2+ ..... + 1 = Sum of n na... |
What's the Time Complexity and total no of iterations? |
you should test it with different combinations of a,b and c. This is the only method I know till now to validate the turing machine you've constructed. |
null |
I think you should take some time after you graduate, and study some selected topics. I think you should necessarily know:
- Some foundations: basic logic, automata and grammars, structural induction on lists and trees and recursion.
- Some algorithm theory, which you can learn from the Cormen Leiserson Rivest S... |
null |
The first approach is correct. The idea is that the sum of the first $n$ numbers can be computed as $$\dfrac{n(n+1)}{2} = \dfrac{n^2 + n}{2} = O(n^2)$$
I would not consider the second one as complete, as since $i$ is a free variable in your complexity expression, the result does not immediately follow unless you qu... |
I did so and I had no problems. But of course it all depends on the level of the master degree you are transitioning.
I had some basics of Computer Science both from school (I did an IT school) and from my Bachelor, where I studied automatas, regular languages and grammars, C programming, a basic Algorithm and Data ... |
null |
We are given two cyclic $\{0,1\}$ strings $X$ and $Y$ with both length $n$, containing $k$ 0s and $n-k$ 1s. Suppose positions in $X$ are $x_0,\dots,x_{k-1}$, for $Y$ are $y_0,\dots,y_{k-1}$. We assume $x_0=y_0=0$. Find $c \in \{0,\dots,n-1\}$ and $s \in \{0,\dots,k-1\}$ minimize $$ \sum_{i=0}^{k-1} d(x_i,y_{(i+s) \mod ... |
Necklace Alignment Problem |
|algorithms|time-complexity| |
We are given two cyclic $\{0,1\}$ strings $X$ and $Y$ with both length $n$, containing $k$ 0s and $n-k$ 1s. Suppose positions in $X$ are $x_0,\dots,x_{k-1}$, for $Y$ are $y_0,\dots,y_{k-1}$. We assume $x_0=y_0=0$. Find $c \in \{0,\dots,n-1\}$ and $s \in \{0,\dots,k-1\}$ minimize $$ \sum_{i=0}^{k-1} d(x_i,y_{(i+s) \mod ... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : My : Bellman-Ford = 10 : 19 ... |
Could this algorithm be qualified to be published to Nature or Science |
|algorithms|graphs|shortest-path| |
Could this novel algorithm be qualified to be published to Nature or Science |
Could this novel algorithm be qualified to be published in Nature or Science |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellman-Ford = 10 : 1... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
Say i have an 2d array A of nxn size, int values already given for each item.these values can be the same or different.
There's gonna be another nxn array B being input. I can only interchange one row to another, or one col with another from B. Basically if an item shares a row/col with another, even if shifted they'l... |
How do i make a 2d array as same as i possibly can with another one? |
|algorithms|time-complexity|dynamic-programming|arrays|c| |
Let $G = (V, E)$ be a connected DAG (representing a circuit) with every vertex may be one of the following three types:
1. Input variable, with in-degree $0$ and out-degree $\geqslant 1$.
2. A gate, with in-degree $2$ and out-degree $\geqslant 1$.
3. Output variable, with in-degree $1$ and out-degree $0$.
Do... |
Complexity of topological sorting with a special restriction |
|graphs|np-complete|np-hard| |
I recommend you write it up, prove its correctness and running time, state explicitly the dataset you used for your experiment, as well as your assumptions about the dataset.
Then upload it to Arxiv. I would personally skip Nature and Science and rather aim at an actual algorithms journal. Perhaps even better is a c... |
I've been reading the book "A Primer on Memory Consistency and Cache Coherency", and it contains the following paragraph:
> The Atomic Requests property states that a coherence request is
> ordered in the same cycle that it is issued. This property eliminates
> the possibility of a block’s state changing—due to an... |
Understanding atomic requests/transactions in a snooping coherence protocol |
|computer-architecture|cpu-cache| |
null |
Assume the following hypothetic scenario:
> You know the values $v_1^0, \ldots, v_n^0$ of $n$ criptocurrencies. You know the
values this currencies will have for the following $m$ days; this is, $v_0^1,
\ldots, v_n^1$ up to $v_1^m, \ldots, v_n^m$. In general, $v_{i}^j$ is the value
of the $i$th currency in $j$ da... |
Greedy algorithm for criptocurrency problem |
|algorithms|decision-problem|greedy-algorithms|knapsack-problems| |
Suppose a polynomial time machine that has an access to a polynomially long string of bits independent on the input. On average, it's impossible to compress this string to a subpolynomially long string using a deterministic polynomial time compression algorithm.
As far as I understand, such a machine would be a $BPP... |
What is the largest "allowed" seed for a PRNG to not give any extra power to a deterministic machine? |
|complexity-theory|time-complexity|randomized-algorithms|randomness|probabilistic-algorithms| |
null |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of transfers as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle.
The runtime ratio is ```SPFA : Mine : Bellm... |
Three years late to the thread but here's another from a Turing Machine perspective:
Defining NP with NTMs and showing that certificate/verifier implies membership of NP
================
We define $NP$ as the set of decision problems that can be solved in polynomial time by a nondeterministic Turing machine (NTM... |
Is the CFG for the (a) part, S -> AxxyxxA, A -> xx|ε? If this is the answer then this grammar would accept "xxyxxxx" also which is wrong. How to do it if this is wrong?
[1]: https://i.stack.imgur.com/p3kY4.png |
CFGs and Pushdown Automata |
|pushdown-automata| |
Is the CFG for the (a) part, S -> AxxyxxA, A -> xx|ε? If this is the answer then this grammar would accept "xxyxxxx" also which is wrong. How to do it if this is wrong?
[![][1]][1]
[1]: https://i.stack.imgur.com/aJC3x.png |
Is the CFG for the (a) part, S -> AxxyxxA
A -> xx|ε
If this is the answer then this grammar would accept "xxyxxxx" also which is wrong. How to do it if this is wrong?
[![][1]][1]
[1]: https://i.stack.imgur.com/aJC3x.png |
Is the CFG for the (a) part, S -> AxxyxxA
A -> Ax|ε
If this is the answer then this grammar would accept "xxyxxxx" also which is wrong. How to do it if this is wrong?
[![][1]][1]
[1]: https://i.stack.imgur.com/aJC3x.png |
Is the CFG for the (a) part, S -> AxxyxxA
A -> Ax|ε
If this is the answer then this grammar would accept "xxyxxx" also which is wrong. How to do it if this is wrong?
[![][1]][1]
[1]: https://i.stack.imgur.com/aJC3x.png |
Is this the CFG for part (a),
S -> AxxyxxA
A -> Ax|ε
If this is the answer then this grammar would accept "xxyxxx" also which is wrong. How to do it if this is wrong?
[![][1]][1]
[1]: https://i.stack.imgur.com/aJC3x.png |
As you noticed, the CFG you have given accepts words not in the language $L$. Therefore, no, it is not correct. We will not do your homework for you, but I will give you the hint that your current CFG is looking at the language "inside-out". |
null |
There are algorithms that speed up matrix multiplication over the naive $n^3$ algorithm. But supposing you have 3 matrices $A$, $B$ and $C$, is there a way to compute $ABC$ that is asymptotically faster than first computing $AB$ and then computing $(AB)C$? Let's assume the matrices are square and dense.
This questio... |
Complexity of multiplying 3 matrices |
|matrix-multiplication| |
No. If you can multiply two $n \times n$ matrices in time $O(f(n))$ then you can also multiply three matrices $A,B,C$ in the same asymptotic running time by first computing $M=AB$ and then $MC$.
Conversely, if you can multiply three matrices in time $O(f(n))$ then you can also multiply two matrices in the same asymp... |
I am trying to understand this [Expected linear time MST algorithm](https://en.wikipedia.org/wiki/Expected_linear_time_MST_algorithm), and I have a problem in the implementation of the [Borůvka's step](https://en.wikipedia.org/wiki/Expected_linear_time_MST_algorithm#Bor%C5%AFvka_Step).
My problem is with the removal... |
Borůvka's step in linear time |
|algorithms|graphs|randomized-algorithms|spanning-trees|connected-components| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.