instruction stringlengths 0 29.8k ⌀ |
|---|
A term means exactly what the person using the term defines it to mean. No more, no less.
The [ECMAScript Language Specification](https://tc39.es/ecma262/) defines the term [*primitive value*](https://tc39.es/ecma262/#sec-primitive-value) as follows:
> # 4.4.5 primitive value
>
> member of one of the types Unde... |
This problem can be split into two steps.
1. For each index $\ell$ with $a_\ell>0$, find the largest index $r$ such that $\sum_{k=l}^ra_k>0$.
Denote that $r$ by $c[\ell]$, which reads "the companion index of $\ell$".
$(\ell, c[\ell])$ is the longest "positive interval" that starts with $a_\ell$. We can a... |
I'm struggling in finding a correct way to approach this, I'm aware that this problem is solvable using dynamic programming, and this problem somehow relates to the "max non-contiguous subarray" problem, yet I cannot make the connection.
Given an array of integers, $A=(a_1,\ldots , a_n)$ for which $\sum_{i=1}^{n}a_i... |
Minimal number of positive intervals to cover all positive elements |
|algorithms|dynamic-programming|arrays|greedy-algorithms|maximum-subarray| |
null |
As far as I know, $(-5)-(-4)=-1$ is correct. |
{"Voters":[{"Id":16034,"DisplayName":"Yves Daoust"}]} |
{"Voters":[{"Id":16034,"DisplayName":"Yves Daoust"}]} |
{"Voters":[{"Id":16034,"DisplayName":"Yves Daoust"}]} |
{"Voters":[{"Id":16034,"DisplayName":"Yves Daoust"}]} |
I have a group with n members. These are distributed members. It is basically a group chat. A new member is added to the group and the existing members are informed about this.
Now I want the new member to obtain some information about the group that the existing members all know. This could be the name of the group... |
Information sharing in group |
|algorithms|distributed-systems| |
A merge can be done with any array sizes, it uses nothing else than the elements themselves.
An FFT is a set of linear combinations of powers of a root of unity $\omega$ and exploits special relations between those powers, such that some intermediate results can be reused. This only works with balanced partitions.
... |
**Short answer:**
A merge works with individual elements. Any numbers can be handled. In particular, *natural* mergesort merges sequences of arbitrary lengths.
The FFT works on pairs of elements, with no leftovers. So there must be an even number of them, and by recurrence, a power of $2$.
----------
Varian... |
**Short answer:**
A merge works with individual elements. Any numbers can be handled. In particular, *natural* mergesort does merge sequences of arbitrary lengths.
The FFT works on pairs of elements, with no leftovers. So there must be an even number of them, and by recurrence, a power of $2$.
----------
Va... |
Let $L=\{<M> | M$ is a TM, $L(M)\ne \emptyset$ and $\forall x\in L(M), \overline{x} \notin L(M) \}$
While $\overline{x}$ is the bit flip of $x$.
I want to show a mapping reduction to prove that this language is either in R / RE / coRE or none of them.
My intuition is that this language does not belong to any ... |
Mapping reduction - Bit Flip |
|complexity-theory|computability|automata|reductions|mapreduce| |
I need a perfect hash function that maps 2 integers into one integer twice the size (i.e. $(Int64, Int64) \rightarrow Int128$).
The function preserves sum of leading zero bits:
- $(0, 0) \rightarrow 0$ - good mapping, as each argument has $64$ leading zeros and that transformed into $128$ leading zeros of the out... |
Perfect hash function that weakly preserves leading zeros |
|hash|hashing| |
I need a perfect hash function that maps 2 integers into one integer twice the size (i.e. $(Int64, Int64) \rightarrow Int128$).
The function preserves sum of leading zero bits:
- $(0, 0) \rightarrow 0$ - good mapping, as each argument has $64$ leading zeros and that transformed into $128$ leading zeros of the out... |
null |
Given a set of points, and a convex d-dimensional polytope represented only by a set of its' vertices, I need to query in order to check for each point if it's inside the polytope. I know of the O(log(n)) solution in 2D (like the answer to https://stackoverflow.com/questions/36135978/show-that-given-a-query-point-q-it-... |
There are a ton of resources on the web devoted to proving some esoteric language is Turing complete by simulating arbitrary turing machines. I have an esoteric language I want to prove is complete, but I'm pretty sure the easier way to do it would be to prove that you can express any untyped lambda calculus term in i... |
Instances of simulating lambda calculus? |
|computability|lambda-calculus|turing-completeness| |
In mathematics and philosophy there are some unsolvable problems like [Russell's paradox] or [the liar's paradox] that are usually said to be undecidable... There are also other "impossibilities" such as finding positive integers to divide a prime number other than the number itself and 1.
However, are these proble... |
Using hypercomputation for "impossible" problems? |
|computability|logic|oracle-machines|philosophy|hypercomputation| |
I need a perfect hash function that maps 2 integers into one integer twice the size (i.e. $(Int64, Int64) \rightarrow Int128$).
The function preserves sum of leading zero bits:
- $(0, 0) \rightarrow 0$ - good mapping, as each argument has $64$ leading zeros and that transformed into $128$ leading zeros of the out... |
null |
These are just ideas, not actual redcutions.
The language indeed seems to be neither RE, nor coRE. It might help to identify what part of the language makes it not RE or not coRE:
- the $L(M)\neq \emptyset$ is a RE part: it can be verified by dovetailing. However, the $\forall x\in L(M), \overline{x}\notin L(M)$... |
null |
There's a famous classical circuit complexity result by Shannon that says almost all languages require exponential circuits [[1]], proven by comparing the number of distinct circuits of $n$ variables versus the number of boolean functions of $n$ variables.
Similarly, there's a result that "almost all" languages are ... |
Are "almost all" languages not in P? |
|complexity-theory|time-complexity|asymptotics| |
Are "almost all" decidable languages not in P? |
O(f(n)) could be a lot smaller than f(n). An extreme one: n = O(n!).
When you divide by some amount and that amount is O(f(n)) then the actual amount could be much less than f(n) which would make the result arbitrarily large. So dividing by some amount, you want a lower bound, not an upper bound. |
null |
Is there any dynamic way of solving this problem? I would thank any help, I know the Subset sum Problem, but for solving it dynamically u have to create a matrix but here is not posible as the colums may not to be integers. |
Given a list of numbers L and a target k, is there a subset of numbers from L whose product is k? |
|dynamic-programming|np|decision-problem| |
null |
Answer to number of languages (and not TMs).
So my intuition would say no, there sre no more decidable problems not in P than the problems in $P$, since you can reduce a problem $L$ of running time $O(|n|)$ into a problem $L’=\{w0^{f(n)}|w\in L\}$ in $P$. This means we add many zeros to each instance, to make the si... |
Answer to number of languages (and not TMs).
So my intuition would say no, there sre no more decidable problems not in P than the problems in $P$, since you can reduce a problem $L$ of running time $O(f(n))$ into a problem $L’=\{w0^{f(|w|)}|w\in L\}$ in $P$, i.e. we add many zeros to each instance, to make the size ... |
In mathematics and philosophy there are some unsolvable problems like [Russell's paradox] or [the liar's paradox] that are usually said to be undecidable... There are also other "impossibilities" such as finding positive integers to divide a prime number other than the number itself and 1.
However, could we use som... |
This answer relates to the number of decidable languages (and not the number of TMs that accept decidable languages).
So my intuition would say no, there sre no more decidable problems not in P than the problems in $P$, since you can reduce a problem $L$ of running time $O(f(n))$ into a problem $L’=\{w0^{f(|w|)}|w\i... |
The Brouwer fixpoint theorem states that any continuous mapping $f$, from a convex, compact set to itself will contain a fixpoint.
The Brouwer algorithm finds these (approximate) fixpoints. But how is a continuous function inputted into this algorithm?
Is it as a black box? If so, would changing this to a discre... |
How is the input to a BROUWER algorithm done |
|algorithms|reference-request|fixed-point| |
null |
null |
I'm stuck here, how can i prove this:
$$L_1 \cup L_2 \subseteq L_1^*L_2^*$$
$$\begin{array}{rcl}
x\in L_1\cup L_2 & \Rightarrow & x\in L_1^* \lor x\in L_2^*\\
&\Rightarrow &x\in L_1^*\cup L_2^*
\end{array}$$
What's next? |
|formal-languages|regular-languages| |
During [diverse double-compiling][1], they say that it is proof that either all the compilers are subverted, or none of them, but they cannot say which one is subverted. In my studies of the technique I tried to draw a figure how we can compile three rounds and after that, knowing exactly which one is compromised. But ... |
Can we extend DDC to three rounds and get more information? |
|compilers|security| |
I need a perfect hash function that maps 2 integers into one integer twice the size (i.e. $(Int64, Int64) \rightarrow Int128$).
The function preserves sum of leading zero bits:
- $(0, 0) \rightarrow 0$ - good mapping, as each argument has $64$ leading zeros and that transformed into $128$ leading zeros of the out... |
Consider the sequence $S$ which enumerates pairs $\langle s,t \rangle$ of 64-bit strings, with the following ordering:
- If $z(s)+z(t) < z(s')+z(t')$, then $\langle s,t \rangle$ is listed before $\langle s',t' \rangle$.
- If $z(s)+z(t) = z(s')+z(t')$ and $z(s) < z(s')$, then $\langle s,t \rangle$ is listed before... |
Nope.
Russell's paradox and the liar's paradox aren't undecidable. They aren't even decision problems.
As far as we know, hypercomputers don't exist. They are an imaginary idea that don't appear likely to exist in the real world. We use them as a thought experiment to imagine what the consequences would be if ... |
To prove why we only need to check strings of length within $[n,2n)$. It is sufficient to prove the following statement. If a DFA $D$ with $n$ states accepts infinite many strings, then $D$ accepts some string $s$ whose length falls in $[n,2n)$.
Suppose it is not the case, then $\forall u\in L(D)$, length of $u$, d... |
There are several ways to formalize the BROUWER problem. The most intuitive is to have $f$ specified by an arithmetic circuit, as in Etessami and Yannakakis, [On the complexity of Nash equilibria and other fixed points](https://homepages.inf.ed.ac.uk/kousha/nash_focs07_full_j_spec_issue_sub.pdf). However, this version ... |
null |
null |
As the title hints, I'm looking for a dynamic programming/greedy approach to find the diameter of a N-ary tree graph.
This must be done in linear time.
The problem states that the graph is undirected when passed to the algorithm, yet there is a way to transform it into a rooted directed tree graph in linear time.... |
Finding the diameter of a N-ary tree graph, without using BFS |
|dynamic-programming|trees|greedy-algorithms| |
As the title hints, I'm looking for a dynamic programming/greedy approach to find the diameter of a N-ary tree graph.
This must be done in linear time.
The problem states that the graph is undirected when passed to the algorithm, yet there is a way to transform it into a rooted directed tree graph in linear time.... |
Upfront, I'm not a computer science or mathematics graduate. I am a dabbler/recreational programmer and I find some problem/solution scenarios intellectually stimulating to attempt. Sometimes (frequently, actually), this lack of formal training limits my ability to formulate a good solution to a problem. I can pretty... |
Letter Boxed Puzzle - Is a minimum set cover plus additional constraints solution viable? |
|algorithms| |
Good Evening,
So I am trying to solve this exercise which is a paticular case of maximum flow algorithm. Here the graph must have all even edges and 1 odd edge and it must have a maximum flow that is odd.
Now I need to prove the following two points which state that the single odd edge must have a flow >1 and/or... |
Maximum Flow algorithm. How to prove the following statements |
|algorithms|graphs|network-flow|ford-fulkerson| |
Good Evening,
So I am trying to solve this exercise which is a paticular case of maximum flow algorithm. Here the graph must have all even edges and 1 odd edge and it must have a maximum flow that is odd.
Now I need to prove the following two points which state that the single odd edge must have a flow >1 and/or... |
Good Evening,
So I am trying to solve this exercise which is a paticular case of maximum flow algorithm. Here the graph must have all even edges and 1 odd edge and it must have a maximum flow that is odd.
Now I need to prove the following two points which state that the single odd edge must have a flow $>1$ and/... |
The [Max-flow/Min-cut theorem](https://en.wikipedia.org/wiki/Max-flow_min-cut_theorem) can be used to prove this property.
As a reminder, $f$ is a max-flow if and only if there exists a cut $X$ of capacity $|f|$.
Let $f$ be a max-flow of odd value in $G$.
a. Suppose there is no flow through $e^*$. Then in $G[... |
null |
Most of the proofs of such properties that I see involve informally using algorithms or invoking Turing machines as needed. But it's not clear to me how are we using set operations on instances of decision problems? Moreover, it is not intuitively clear to me how we can use different instances of decision problems for ... |
Why is the collection of decision problems closed under set operations? |
|turing-machines|decision-problem|closure-properties| |
I am trying to build the logic behind a divide and conquer algorithm that will find the majority element in a matrix $A$ with $n$ elements in $O(nlogn)$ time.
I started by thinking that this is no different than getting the elements in an array, plus putting them in an array would only use up $O(n)$ so it wouldn't ... |
How do I find majority element in this case? |
|arrays|divide-and-conquer| |
The idea is to keep track of a "majority candidate" with each recursive call. When trying to merge solutions, if majority candidates are different in each half, you just need to browse the array to check which one appear more than the other. The most frequent will become the new majority candidate.
Note that, as you... |
The idea is to keep track of a "majority candidate" with each recursive call. When trying to merge solutions, if majority candidates are different in each half, you just need to browse the array to check which one appear more than the other. The most frequent will become the new majority candidate.
Let $T(n)$ denote... |
I faced the following claim on wikiepdia about interval graphs (https://en.wikipedia.org/wiki/Interval_graph):
> The pathwidth of an interval graph is one less than the size of its maximum clique.
I have thought a while about it, but don't come up with any argument/proof why the pathwidth is bounded by the ... |
Relationships between path width and clique size of interval graphs |
|algorithms|graphs|decomposition|treewidth| |
I am trying to build the logic behind a divide and conquer algorithm that will find the majority element in a matrix $A$ with $n$ elements in $\mathcal{O}(nlogn)$ time.
I thought that in order to make it divide and conquer, I'd need to split the array in two parts. By definition the majority element would be the on... |
Finding majority element in $\mathcal{O}(nlogn)$ time |
In computational creativity, how do you measure how creative something is?
Let's say you have to compare a piece of music written by Bach and then compare it to Chopin, how would you evaluate how creative they are and compare them both by giving them scores? How would the model work, are there existing models, and h... |
In computational creativity, how do you measure how creative something is? |
|computability| |
null |
You can't. Creativity is subjective. There is no such metric. |
A term means exactly what the person using the term defines it to mean. No more, no less.
The [ECMAScript Language Specification](https://tc39.es/ecma262/) defines the term [*primitive value*](https://tc39.es/ecma262/#sec-primitive-value) as follows:
> # 4.4.5 primitive value
>
> member of one of the types Unde... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.