instruction
stringlengths
0
29.8k
⌀
null
Given a list of intervals with integral endpoints, we want to find out if we can choose one integer from each interval so that no two chosen numbers are adjacent. Can we do this in polynomial time? My attempt is the following greedy strategy: Sort the intervals by the smaller left endpoint, breaking ties by the smal...
Choose non-adjacent numbers from intervals
|algorithms|intervals|
During my self study for graphs, I'm currently learning about topological sorting and ran into a question I'm not sure how to solve. There are typically more than one order of a topological ordering for any given DAG. Some vertices will always be in the same index regardless of the ordering. Find a linear algorithm...
Getting all vertices with fixed index in their topological ordering of a DAG
|algorithms|graphs|graph-traversal|dag|topological-ordering|
How clock rate is doubled in the Manchester encoding? clock cycle depends on bit interval time . In NRZ , Manchester encoding and every other Encoding the clock cycle time is same as bit interval is same. How it is doubled clock rate?
Manchester encoding
|computer-networks|
How clock rate is doubled in the Manchester encoding? clock cycle depends on bit interval time . In NRZ , Manchester encoding and every other Encoding the clock cycle time is same as bit interval is same. How it is doubled clock rate? ISRO | ISRO CS 2020 | Question 67 To send same bit sequence, NRZ encoding req...
Sorry, your question is not very clear, but if I'm reading it correctly, you're asking why the clock rate of Manchester encoding is double that of the bit rate. It depends on what you mean by "clock rate". If you understand a full clock cycle as "high followed by low", or "low followed by high", then the bit rate...
### "AND NOT" Criterion > If we make the restriction that all gates are reversible (in particular, we require fixed input/output size), does the AND/NOT criterion still hold? Yes (well sort of). Sort of, because AND is not reversible. To simulate it with a reversible circuit you would have to implement a functi...
null
null
This question is answered by Alon and Schieber [1]. For a constant $k \geq 2$, the asymptotic bound is $f(n,k) = \Theta(n \lambda(k,n))$ where $\lambda(k,\cdot)$ is a certain slowly growing function. Concrete values are: $ \begin{equation} f(n,2) = \Theta(n \log n) \\ f(n,3) = \Theta(n \log \log n) \\ f(n,4) = \...
{"Voters":[{"Id":6553,"DisplayName":"Pseudonym"},{"Id":79440,"DisplayName":"Nathaniel"},{"Id":16034,"DisplayName":"Yves Daoust"}]}
Very simple via dynamic programming (which is just a big name for a very simple principle). If you have one single array element, you have no choice but taking that element as the only subarray. If you have k ≥ 2 array elements, then you can take all k elements as the only subarray. Or you take 1 element as the...
Andrej Bauer rightly points out that in general, it does not make sense to ask whether a particular machine/program/gadget is Turing complete. However, it does make sense when such a device is *programmable*: when it can read a specification of what it needs to do, and then do that. In other words: when it implement...
Calculating powers with integer exponents: You use these formulas: x^0 = 1. x^(k+1) = x^k * x. x^(2k) = (x^k)^2. x^(-k) = 1 / x^k. Then you implement via recursion: if (k == 0) return 1.0; if (k < 0) return 1.0 / myPower (x, -k); if (k % 2 == 1) return myPower (x, k-1) * x; /* if (k % 2 == 0)...
Sorry, your question is not very clear, but if I'm reading it correctly, you're asking why the clock rate of Manchester encoding is double that of the bit rate. It depends on what you mean by "clock rate". If you understand a full clock cycle as "high followed by low", or "low followed by high", then the bit rate...
I'm trying to find a regular expression to describe the following language: ${a^n xa^n | n≥1,x ∈ Σ^* }$ where $Σ$ = {a,b} So far I've come up with $aa^* (aUb)^* aa^*$ but I don't think that accounts for `n` being the same.
Language to regluar expression
|formal-languages|regular-languages|regular-expressions|
I'm trying to find a regular expression to describe the following language: $\{a^n xa^n | n≥1,x ∈ Σ^* \}$ where $Σ$ = \{a,b\} So far I've come up with $aa^* (aUb)^* aa^*$ but I don't think that accounts for `n` being the same.
I'm trying to find a regular expression to describe the following language: $\{a^n xa^n | n≥1,x ∈ Σ^* \}$ where $Σ$ = \{a,b\} So far I've come up with $aa^* (aUb)^* aa^*$ but I don't think that accounts for $n$ being the same.
Andrej Bauer rightly points out that in general, it does not make sense to ask whether a particular machine/program/gadget is Turing complete. However, it does make sense when such a device is *programmable*: when it can read a specification of what it needs to do, and then do that. In other words: when it implement...
Your problem is that your language is not a regular language, so you are not going to find a regular expression, whatever you try. Neither is anyone else. To see very easily that it is not regular: A regular language has a finite state machine. Now take the strings a^n b for every possible integer n. What is the sho...
Language to regular expression to prove it is regular
Your language consists of all words that start with $a$ and end with a different $a$, which yields the regular expression $a(a+b)^\ast a$. Note that every word that at first seems *unbalanced*, e.g. $a^n y a^{n+k}$ for some $y \in \Sigma^\ast$ and $k > 0$ (analogously too many $a$ on the left) can be regrouped to $a^n ...
null
Your problem is that your language is not a regular language, so you are not going to find a regular expression, whatever you try. Neither is anyone else. To see very easily that it is not regular: A regular language has a finite state machine. Now take the strings a^n b for every possible integer n. What is the sho...
null
My Problem is having to work with real-time server in a DES model. I have the following situation: I want to build a discrete event simulation model (*Using event scheduling world view*). However, this model needs to be connected to another **real-time** program.<br/><br/> Within this model, the event routines cre...
How to simulate a Discrete Event Simulation model with a real-time server?
|simulation|real-time|
I've read about that the number of distinct paths in a graph can be exponential in relation to the number of vertices, later I've encountered a problem which I've spent some time trying to solve on my own. The problem asks to find a family of undirected graphs in such manner that every graph has a pair of vertices `...
Finding a family of graphs that displays a certain characteristic
|graphs|path|
Consider a clique $G=(V,E)$ on $n$ vertices and any two distinct nodes $s$ and $t$. Any permutation $v_1, v_2, \dots, v_{n-2}$ of the vertices in $V \setminus \{s,t\}$ induces a simple path from $s$ to $t$, namely $\langle s, v_1, v_2, \dots, v_{n-2}, t \rangle$. Therefore the numebr of paths from $s$ to $t$ is at ...
Today I am reading papers: [Unsatisfiable Linear k-CNFs Exist, for every k][1] . But I have some problem to understand the proof of Theorem 3. I don't know how to understand the underlined part: 1. How to create disjoint copies of $F$? 2. Why the number is $2^m$? [![enter image description here][2]][2] ...
Question about linear K-CNF
|satisfiability|
Consider a clique $G=(V,E)$ on $n$ vertices and any two distinct nodes $s$ and $t$. Any permutation $v_1, v_2, \dots, v_{n-2}$ of the vertices in $V \setminus \{s,t\}$ induces a simple path from $s$ to $t$, namely $\langle s, v_1, v_2, \dots, v_{n-2}, t \rangle$. Therefore the numebr of paths from $s$ to $t$ is at ...
I'm self studying complexity theory and want to prove that SAT is in NP, so I came up with this verifier for SAT: \begin{align*} V &= \text{"On input $w = \langle \phi, c \rangle$}:\\ & \quad \text{1. Test whether $c$ is an assignment for $\phi$} \\ & \quad \text{2. Test whether $c$ satisfies $\phi$}\\ & \quad \...
Understanding this verifier runs in plynomial time
|complexity-theory|time-complexity|
You just need to show that you can evaluate $\phi$ in polynomial-time. This is clearly true for any reasonable encoding of $\phi$ and $c$, but the details depend on the specific encoding you choose. One of the many possible "natural" encodings could be as follows: $\phi$ is encoded by specifying the number of varia...
You just need to show that you can evaluate $\phi$ in polynomial-time. This is clearly true for any reasonable encoding of $\phi$ and $c$, but the details depend on the specific encoding you choose. One of the many possible "natural" encodings could be as follows: $\phi$ is encoded by specifying the number of varia...
An operator can be described in terms of three things: * The accepted range of values (type) of each of its operands * Its behaviour * The possible values (type) of its result The simplest "or" operator is defined as having two operands and a result all with values "true" or "false", i.e. a "boolean" type. With...
An operator can be described in terms of three things: * The accepted range of values (type) of each of its operands * Its behaviour * The possible values (type) of its result The simplest "or" operator is defined as having two operands and a result all with values "true" or "false", i.e. a "boolean" type. With...
We are learning about encryption (e.g. RSA) in class at the moment and our teacher told us about a paper he had read (and didn't remember the name) which presented an interesting encryption method. The premise was that the method didn't require the exchanging of any key (no public key of the recipient of a message requ...
What is the encryption method that works without exchanging any public or private keys at all?
|encryption|
null
Say I have a big matrix, ~50000 rows, ~80000 columns. I want to split it up and solve subproblems on different machines (horizontal scaling). But I need to make sure every column can be combined with every other column. Thinking about, I can't really think of an efficient algorithm that could split the matrix up ...
Split matrix by groups of columns but *capture all combinations*
|algorithms|distributed-systems|matrices|
null
I've read that the number of distinct paths in a graph can be exponential in relation to the number of vertices, later I encountered a problem which I spent some time trying to solve on my own. The problem asks to find a family of undirected graphs in such a manner that every graph has a pair of vertices $s$ and $t$...
It's published in _Journal of Computational Geometry: Theory and Applications_, DOI [10.1016/j.comgeo.2010.11.004](https://doi.org/10.1016/j.comgeo.2010.11.004) by Cheong, Otfried and Everett, Hazel and Glisse, Marc and Gudmundsson, Joachim and Hornus, Samuel and Lazard, Sylvain and Lee, Mira and Na, Hyeon-Suk. T...
Consider a clique $G=(V,E)$ on $n$ vertices and any two distinct nodes $s$ and $t$. Any permutation $v_1, v_2, \dots, v_{n-2}$ of the vertices in $V \setminus \{s,t\}$ induces a simple path from $s$ to $t$, namely $\langle s, v_1, v_2, \dots, v_{n-2}, t \rangle$. Therefore the numebr of paths from $s$ to $t$ is at ...
I am not sure what you mean by "combining" exactly. I assume you want the parallel threads to have read and write access to all data without maintaining multiple copies. I have dealt with a similar problem while working with large networks in a GPU environment (for doing multi-device scaling), this answer will be a...
$\newcommand{\vbl}{\text{vbl}}$ Suppose $\vbl(F)=\{y_1,\cdots, y_v\}$, i.e., $F$ is a CNF over variables in $\vbl(F)$. Let $\{y_{i,j}\mid 1\le i\le 2^m, 1\le j\le v\}$ be a set of distinct $2^mv$ variables. For each $i=1,\cdots, 2^m$, let $F_i$ be $F$ with every appearance of $y_j$ replaced with $y_{i,j}$ and ev...
null
null
Let $A$ be any unary language. Prove that if $A$ is NP-complete, then P=NP. Approach 1: We just have to prove that we can decide $A$ in polynomial time. Consider a Turing machine that on input $w$, scans all the symbols of $w$. If they are all 1s, accept; otherwise, reject. This TM runs in polynomial time, so $A$ is...
Question about unary languages
|complexity-theory|time-complexity|polynomial-time-reductions|
Today I am reading paper [Unsatisfiable Linear k-CNFs Exist, for every k][1] by *Dominik Scheder*, 2007. But I have some problem to understand the proof of Theorem $3.2$. I don't know how to understand the underlined part: 1. How do we create variable-disjoint copies of $F$? 2. Why is the number $2^m$? > **...
Question about a proof of the existence of unsatisfiable linear k-CNFs for any k
|np-complete|satisfiability|
Suppose $\text{vbl}(F)=\{y_1,\cdots, y_v\}$, i.e., $F$ is a CNF over variables in $\text{vbl}(F)$. Let $\{y_{i,j}\mid 1\le i\le 2^m, 1\le j\le v\}$ be a set of distinct $2^mv$ variables. For each $i=1,\cdots, 2^m$, let $F_i$ be $F$ with every appearance of $y_j$ replaced with $y_{i,j}$ and every appearance of $\b...
Very simple via dynamic programming (which is just a big name for a very simple principle). If you have one single array element, you have no choice but taking that element as the only subarray. If you have k ≥ 2 array elements, then you can take all k elements as the only subarray. Or you take 1 element as the...
Section 10.1.2 of Sanjeev Arora and Boaz Barak's *Computational Complexity: A Modern Approach* defines random self-reducibility and proves hardness of the discrete logarithm by reducing a worst case input to a series of random instances. The proof is rather straight forward, but I am having trouble replicating the fina...
Random Self-Reducibility of the Discrete Logarithm Problem
|complexity-theory|randomized-algorithms|
I just got a small confusion here, I have a graph for which i need to get number of minimum spanning tree, [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/lw1X1.jpg So, in graph i have 3 edges with weight 2 and 4 edges with weight 3, in such a way that AE = AB = BE = 2 and ED = DC = ...
MInimum Spanning Tree and Combinatorics
|weighted-graphs|minimum-spanning-tree|
I just got a small confusion here, I have a graph for which i need to get number of minimum spanning tree, [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/lw1X1.jpg So, in graph i have 3 edges with weight 2 and 4 edges with weight 3, in such a way that AE = AB = BE = 2 and ED = DC = ...
AE-ED-DC-BC-AB contains $5$ edges, when the solutions you counted contained $4$ edges (rightly so), so there is indeed $15$ solutions, and AE-ED-DC-BC-AB is not one of them.
I think you may be mis-understanding the interpretation of the solution. ${3 \choose 2} (2 + {3 \choose 2})$ is the sum of the two distinct cases you cases you pointed out. In both cases, 2 edges from $\{AB, AE, BE\}$ are chosen. This is in accordance with algorithms such as Prim's for greedily constructing MSTs. T...
Split matrix by groups of columns but *capture all combinations of X columns* for some X
|algorithms|distributed-systems|matrices|
There are linear-time algorithms to construct a farthest-point Voronoi diagram given a sorted list of vertices of a convex polygon. For a general set of points, first computing the convex hull results in $O(n \log n)$-time algorithms. First algorithm [1] is deterministic. Second algorithm [2] is randomized but much ...
null
In case you haven't worked it out yet, here's my best explanation. --- Firstly, notice how we can have any number of $a$ characters at the start. So, to make life easy let's assume we have none. If we then let $w=b^pc^p$, we can see that this is part of $L$ (when $r=0$ and $q=p$). We then take a look at the cond...
I am looking for answers creating 500 samples of non-stationary Time series based on its probability distribution preferably using monte-carlo simulation. [DATA LINK][1] Secondly, the most example available on any platform are considering normal distribution for creating the sample (like Monte Carlo) which sees fit...
How to create random pseudo samples from a non-stationary time series containing NaNs using Monte-Carlo method?
|statistics|pseudo-random-generators|monte-carlo|
null
The multi-source shortest path problem for unweighted and undirected graph is as follows: Given an unweighted and undirected graph, find the length of the shortest path between any pair of vertexes. A straightforward method is to use BFS starting from each vertex, as the time complexity of BFS is *O*(*V*+*E*), the ...
The solution for the multi-source shortest path problem on unweighted and undirected graph
|graphs|shortest-path|
Very simple via dynamic programming (which is just a big name for a very simple principle). If you have one single array element, you have no choice but taking that element as the only subarray. If you have k ≥ 2 array elements, then you can take all k elements as the only subarray. Or you take 1 element as the...
null
So, I have N sets of objects of various sizes. I want to put them in order, in a way that's as much "alternative" as possible. For example, if I have 5 A, and 6 b, that's easy: B A B A B A B A B A B If I have 5 A, 6 B, and 2 C, it could be something like that: B A B A C B A B C A B A B Any idea how I could ...
Algorithm to alternaly order elements in a list
|algorithms|sorting|