instruction stringlengths 0 29.8k ⌀ |
|---|
This is a follow-up for https://cs.stackexchange.com/questions/162076/weighted-interval-scheduling-with-m-machines-greedy-solution-with-approximati/162078?noredirect=1#comment338898_162078.
I would like to clarify a few practical constraints based on real-world scenarios. Let me provide a few notations first. Denote... |
Weighted interval scheduling on K-identical machines --- approximation factor |
|algorithms|approximation|scheduling| |
Consider two large numbers $a$ and $b$ of which some, not necessarily prime factors, are known. This means $a = a_1 \cdot \dots \cdot a_n$ and $b = b_1 \cdot \cdots \cdot b_m$. Required is their quotient
$$
\frac a b = \frac {a_1 \cdots a_n} {b_1 \cdots b_m}
$$
of which is also known that it is a (positive) integer... |
Consider two large numbers $a$ and $b$ of which some, not necessarily prime factors, are known. This means $a = a_1 \cdot \dots \cdot a_n$ and $b = b_1 \cdot \cdots \cdot b_m$. Required is their quotient
$$
\frac a b = \frac {a_1 \cdots a_n} {b_1 \cdots b_m}
$$
of which is also known that it is a (positive) integer... |
null |
This is a follow-up for https://cs.stackexchange.com/questions/162076/weighted-interval-scheduling-with-m-machines-greedy-solution-with-approximati/162078?noredirect=1#comment338898_162078.
As suggested by @D.W., I will present the problem more comprehensively.
$\textbf{Problem Definition}$: <br/>
Given $n$ inte... |
This is a follow-up for https://cs.stackexchange.com/questions/162076/weighted-interval-scheduling-with-m-machines-greedy-solution-with-approximati/162078?noredirect=1#comment338898_162078.
As suggested by @D.W., I will present the problem more comprehensively.
$\textbf{Problem Definition}$: <br/>
Given $n$ inte... |
it's still O(n^3), big o notation is about asymptomatics. |
Suppose some hash family H satisfies $$Pr_{h_{\in_{R}} H}[h(x_1) = h(x_2)] = \frac{1}{|Y|}$$ Does it mean H is 2 universal?
The converse is true, but I'm not sure about this. |
Suppose some hash family H satisfies $$Pr_{h_{\in_{R}} H}[h(x_1) = h(x_2)] = \frac{1}{|Y|}$$ Does it mean H is 2 universal? |
|hash| |
The time complexity of the matrix product is $O(n^3)$ if calculated normally for each element.
If computed on GPU, is it $O(n)$?
What I thought:
- GPU can compute each element of the matrix product in parallel.
- Each element is computed by a inner product of vectors $\sum_{k=1}^n a_kb_k$
- Each $a_kb_k$ ... |
This is a follow-up for https://cs.stackexchange.com/questions/162076/weighted-interval-scheduling-with-m-machines-greedy-solution-with-approximati/162078?noredirect=1#comment338898_162078.
As suggested by @D.W., I will present the problem more comprehensively.
$\textbf{Problem Definition}$: <br/>
Given $n$ inte... |
From wikipedia
> Time complexity is commonly estimated by counting the number of elementary operations performed by the algorithm
It doesn't take into consideration the computing capabilities of the underlying machine. No matter the machine on which it is computed, the number of operations remain the same.
Wha... |
From wikipedia
> Time complexity is commonly estimated by counting the number of elementary operations performed by the algorithm
It doesn't take into consideration the computing capabilities of the underlying machine. No matter the machine on which it is computed, the number of operations remain the same.
Wha... |
If you assume $n^2$ processing elements (which is unbounded), then yes the complexity is $O(n)$. But the *total cost* (complexity times number of PEs) remains $O(n^3)$.
On the opposite, if the number of PEs is bounded, the complexity remains $O\left(\dfrac{n^3}{p}\right)$, which is $O(n^3)$. |
Under the setting of the presented problem definition, if we sort the intervals by profit first instead of profit-to-duration first, I found an obvious approximation factor $n$ for this the other greedy-like solution
(number of intervals). |
it's still O(n^3), big o notation is about asymptotics. |
Say we have an alphabet of size $S$, a pattern of length $P$ and a text of length $T$. This can be solved:
- By $\text{KMP/Z}$ against all $S$ rotations of $P$ in time $O(P+ST)$ (we
can reuse the $\text{LPS/Z}$ array of the pattern).
- By $\text{Aho-Corasick}$ against all $S$ rotations of $P$ in time $O(SP+T)... |
Simultaneous matching of all caesar rotations of a pattern in a text |
|strings|substrings|string-matching|exact-string-matching| |
I remember seeing a list of False Proofs when I was taking Discrete Maths and I found it to be very interesting and also helpful.
So, if anyone knows some common proof mistakes students make or some cool sneaky way to trick people in a proof send them my way! Bonus points if they're cs/algorithms related.
... |
Gaussian integer is a complex number whose real and imaginary parts are both integers.
Say I want raise $(a + b*i)$ to power $(c + d*i)$ and have result modulo $m$.
I can do it with floating-point approximation using normal complex power, as defined with exp and ln. But this is not precise, I can lost important l... |
Raise gaussian integer to gaussian integer power |
|number-theory|multiplication| |
Gaussian integer is a complex number whose real and imaginary parts are both integers.
Say I want raise $(a + b*i)$ to power $(c + d*i)$ and have result modulo $m$.
I can do it with floating-point approximation using normal complex power, as defined with exp and ln. But this is not precise, I can lost important l... |
In general the result is transcendental, so no.
E.g., $i^i=e^{-\pi/2}$. |
The AND boolean function $AND(x)$ can be represented using the polynomial $P(x) = x_1x_2\cdots x_n$. I have a few questions:
1. Is there a similar polynomial for the PARITY boolean function?
2. Is there a boolean function whose polynomial doesn't have a maximum possible degree?
|
Polynomial representations of Boolean functions |
|boolean-algebra|polynomials|algebra| |
null |
Given an ordered list of two-dimensional points $P$ that represent the vertices of an $N$-sided (very) self-intersecting polygon, find a point $p_{best}$ with the highest winding number of all points within that polygon represented by $P$.
Sunday's algorithm sounds great for efficient calculation given one point, bu... |
Efficient algorithm for finding a point P with the highest winding number |
|algorithms|computational-geometry|polygons| |
You are given the number $m$ and $m$ intervals of the form $a_i, b_i, v_i$, where $a_i<=b_i$ and $v_i>0$ and also a number $n$ and an array $s$ of length $n$, where $s_i>0$. In one operation you can choose an interval say $j$ and decrease the values of $s_i$ by 1, where $a_j<=i<=b_j$, and you can choose interval $j$ at... |
Given m intervals and an array of integers, your task is to minimize the number of operations in which you can make the elements of the array nonnegve |
|greedy-algorithms|intervals|segment-trees| |
You are given the number $m$ and $m$ intervals of the form $a_i, b_i, v_i$, where $a_i<=b_i$ and $v_i>0$ and also a number $n$ and an array $s$ of length $n$, where $s_i>0$. In one operation you can choose an interval say $j$ and decrease the values of $s_i$ by 1, where $a_j<=i<=b_j$, and you can choose interval $j$ at... |
Given m intervals and an array of integers, your task is to minimize the number of operations in which you can make the elements of the array nonposit |
Your greedy approach does not work.
Consider the $m=2$ intervals $[1,2]$ and $[2,3]$ each of which can only be used once. Let the array $s$ of $n = 3$ elements be $\langle 0, 1, 1 \rangle$.
Your approach uses $2$ operations, namely it chooses first the interval $[1,2]$ and then the interval $[2,3]$. However, the mi... |
My understanding of the [Curry–Howard correspondence][1] is that it shows an isomorphism between constructive logic (also called intuitionistic logic) and computer programs in appropriate typed languages.
Basically, a (logical) proposition corresponds to a type, a proof (of that proposition) is an inhabited type, a ... |
Curry-Howard isomorphism and non-constructive logic |
|logic|type-theory|proof-assistants|curry-howard| |
Regarding $1$:
$$
\text{PARITY}(x_1,x_2,\dots,x_n) = \frac{1}{2} \cdot(1-2x_1) \cdot (1-2x_2) \cdot \ldots \cdot (1-2x_n) + \frac{1}{2}
$$
The idea is that the term $(1-2x_i)$ will be $1$ if $x_i=0$ and $-1$ otherwise. The product of all these terms will have absolute value $1$ and the sign will encode the pari... |
{"Voters":[{"Id":163048,"DisplayName":"meeeeee"}],"DeleteType":1} |
Regarding $1$:
$$
\text{PARITY}(x_1,x_2,\dots,x_n) = \frac{1}{2} \cdot(1-2x_1) \cdot (1-2x_2) \cdot \ldots \cdot (1-2x_n) + \frac{1}{2}
$$
The idea is that the term $(1-2x_i)$ will be $1$ if $x_i=0$ and $-1$ otherwise. The product of all these terms will have absolute value $1$ and the sign will encode the pari... |
{"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
The AND boolean function $AND(x)$ can be represented using the polynomial $P(x) = x_1x_2\cdots x_n$. Is there a similar polynomial for the PARITY boolean function? |
The AND boolean function $AND(x)$ can be represented using the polynomial $P(x) = x_1x_2\cdots x_n$. I have a few questions:
1. Is there a similar polynomial for the PARITY boolean function?
2. Is there a boolean function whose polynomial doesn't have a maximum possible degree?
|
**Overview of 5-state holdouts**
The best overview of "unproven" machines by various sources currently is: https://bbchallenge.org/story#skelets-43-undecided-machines As highlighted by the bbchallenge, it also depends a lot on what you consider "verified", ranging from manual proof, to unverified programmatic checks... |
**Overview of 5-state holdouts**
The best overview of "unproven" machines by various sources currently is: https://bbchallenge.org/story#skelets-43-undecided-machines As highlighted by the bbchallenge, it also depends a lot on what you consider "verified", ranging from manual proof, to unverified programmatic checks... |
{"Voters":[{"Id":10517,"DisplayName":"Ciro Santilli OurBigBook.com"}],"DeleteType":1} |
{"Voters":[{"Id":10517,"DisplayName":"Ciro Santilli OurBigBook.com"}]} |
**Overview of 5-state holdouts**
The best overview of "unproven" machines by various sources currently is: https://bbchallenge.org/story#skelets-43-undecided-machines As highlighted by the bbchallenge, it also depends a lot on what you consider "verified", ranging from manual proof, to unverified programmatic checks... |
**`n log(n)` by Harvey and van der Hoeven (2021)**
This was mentioned in a two comments previously ([1](https://cs.stackexchange.com/questions/16226/what-is-the-fastest-algorithm-for-multiplication-of-two-n-digit-numbers#comment323158_16226), [2](https://cs.stackexchange.com/questions/16226/what-is-the-fastest-algor... |
**Overview of 5-state holdouts**
The best overview of "unproven" machines by various sources currently is: https://bbchallenge.org/story#skelets-43-undecided-machines As highlighted by the bbchallenge, it also depends a lot on what you consider "verified", ranging from manual proof, to unverified programmatic checks... |
I'm trying to check if the binary tree is binary search tree. My idea is to use [Morris traversal][1]. Intuitively a binary tree is balanced **iff** Morris traversal produces a sorted threaded linked list.
The problem is I could not prove this proposition strictly. Is it even correct so it's safe to use it for binar... |
Is binary tree balanced if and only if the morris traversal of the tree produces ordered list? |
|algorithms|trees|binary-search-trees|tree-traversal| |
{"OriginalQuestionIds":[111839],"Voters":[{"Id":-1,"DisplayName":"Community","BindingReason":{"DuplicateApprovedByAsker":""}}]} |
I think people sometimes disagree on what exactly Curry-Howard is. But, one way to look at it is an exact correspondence between the syntactic rules for logic and for type theory.
For the presentations type theory is usually based on, this continues to hold for classical logic. Typically type theories are written us... |
For reference, the $Y$-combinator is the expression
$$ Y = \lambda f . (\lambda x . f (xx)) (\lambda x . f (xx)) $$
in the untyped lambda calculus. If $g$ is any lambda expression, then
\begin{align}
Y g
&= \lambda f . (\lambda x . f (xx)) (\lambda x . f (xx)) g \\
&\to_\beta (\lambda x ... |
Is it actually the case that $Yg \to_\beta g(Yg)$? |
|lambda-calculus| |
I think people sometimes disagree on what exactly Curry-Howard is. But, one way to look at it is an exact correspondence between the syntactic rules for logic and for type theory.
For the presentations type theory is usually based on, this continues to hold for classical logic. Typically type theories are written us... |
null |
I think it is technically incorrect that $Y g →_β g(Yg)$ using the definitions you've given. However, the one step $β$ reduction of $Yg$ is a fixed point of $g$ under reduction. Since the things you've given names to give no easy way to refer to this one step reduction, people just write $Yg$ instead, and don't worry a... |
Marek, V. Wiktor. [*Introduction to Mathematics of Satisfiability*][1]. Boca Raton; London; New-York: CRC Press, 2009, p. 310:
>***THEOREM 13.3 (Schaefer Theorem)***<br>
>*Let $Γ$ be a collection of Boolean tables. If one of conditions (1)–(6) below holds, then $CSP(Γ)$ is solvable in polynomial time. Otherwise, i... |
Marek, V. Wiktor. [*Introduction to Mathematics of Satisfiability*][1]. Boca Raton; London; New-York: CRC Press, 2009, p. 310:
>***THEOREM 13.3 (Schaefer Theorem)***<br>
>*Let $Γ$ be a collection of Boolean tables. If one of conditions (1)–(6) below holds, then $CSP(Γ)$ is solvable in polynomial time. Otherwise, i... |
null |
Marek, V. Wiktor. [*Introduction to Mathematics of Satisfiability*][1]. Boca Raton; London; New-York: CRC Press, 2009, p. 310:
>***THEOREM 13.3 (Schaefer Theorem)***<br>
>*Let $Γ$ be a collection of Boolean tables. If one of conditions (1)–(6) below holds, then $CSP(Γ)$ is solvable in polynomial time. Otherwise, i... |
null |
null |
null |
**`n log(n)` by Harvey and van der Hoeven (2021)**
This was mentioned in two comments previously ([1](https://cs.stackexchange.com/questions/16226/what-is-the-fastest-algorithm-for-multiplication-of-two-n-digit-numbers#comment323158_16226), [2](https://cs.stackexchange.com/questions/16226/what-is-the-fastest-algorit... |
null |
null |
**Overview of 5-state holdouts**
All 4-state machines [have been proven in 1983](https://www.jstor.org/stable/2007539), but as of 2023 there appear to be some 5-state holdouts. The way things are progressing however, it feels likely that all of them will eventually be solved. 6-state machines might quite possibly re... |
**Overview of 5-state holdouts**
All 4-state machines [have been proven in 1983](https://www.jstor.org/stable/2007539), but as of 2023 there appear to be some 5-state holdouts. The way things are progressing however, it feels likely that all of them will eventually be solved. 6-state machines might quite possibly re... |
While proof assistants typically use constructive mathematics, the Curry-Howard-Correspondence does not necessarily require constructivism.
The important aspect of the correspondence is that the logical rules correspond to the type-checking rules of your programming language of choice.
The "natural" correspondence ... |
**Overview of 5-state holdouts**
All 4-state machines [have been proven in 1983](https://www.jstor.org/stable/2007539), but as of 2023 there appear to be some 5-state holdouts, or we are not too sure due to organizational issues. The way things are progressing however, it feels likely that all 5-states machine will ... |
*Any* Boolean function of $n$ variables can be realized by a polynomial of degree $n$, using multilinear interpolation.
$$f(x_1, x_2, x_3,\cdots x_n)=(1-x_1)f(0, x_2, x_3,\cdots x_n)+x_1f(1, x_2, x_3,\cdots x_n)$$
and so on inductively.
You can expand the result as a linear combination of your $AND$ polynomial... |
*Any* Boolean function of $n$ variables can be realized by a polynomial of degree $n$, using multilinear interpolation.
$$f(x_1, x_2, x_3,\cdots x_n)=(1-x_1)f(0, x_2, x_3,\cdots x_n)+x_1f(1, x_2, x_3,\cdots x_n)$$
and so on inductively.
You can expand the result as a linear combination of your $AND$ polynomial... |
*Any* Boolean function of $n$ variables can be realized by a polynomial of degree $n$, using multilinear interpolation.
$$f(x_1, x_2, x_3,\cdots x_n)=(1-x_1)f(0, x_2, x_3,\cdots x_n)+x_1f(1, x_2, x_3,\cdots x_n)$$
and so on inductively.
You can expand the result as a linear combination of your $AND$ polynomial... |
*Any* Boolean function of $n$ variables can be realized by a polynomial of degree $n$, using multilinear interpolation.
$$f(x_1, x_2, x_3,\cdots x_n)=(1-x_1)f(0, x_2, x_3,\cdots x_n)+x_1f(1, x_2, x_3,\cdots x_n)$$
and so on inductively.
You can expand the result as a linear combination of your $AND$ polynomial... |
{"Voters":[{"Id":16034,"DisplayName":"Yves Daoust"}],"DeleteType":1} |
{"Voters":[{"Id":16034,"DisplayName":"Yves Daoust"}]} |
null |
**Overview of 5-state holdouts**
All 4-state machines [have been proven in 1983](https://www.jstor.org/stable/2007539), but as of 2023 there appear to be some 5-state holdouts, or we are not too sure due to organizational issues. The way things are progressing however, it feels likely that all 5-states machine will ... |
A binary tree is a binary search tree iff its inorder traversal yields an ordered list.
Inorder (or symmetric) traversal is recursively defined as left-node-right. This recurrence is of course directly connected to the defining property of search trees: the items of the left subtree are smaller than the root, which... |
null |
**Logical AND:** Use the linear constraints $y_1 \ge x_1 + x_2 - 1$, $y_1 \le x_1$, $y_1 \le x_2$, $0 \le y_1 \le 1$, where $y_1$ is constrained to be an integer. This enforces the desired relationship. See also https://or.stackexchange.com/q/37/2415.
**Logical OR:** Use the linear constraints $y_2 \le x_1 + x_2$,... |
Suppose, we have an alphabet of size $S$, a pattern of length $P$ and a text of length $T$. We want to design an algorithm for matching of all [caesar rotations](https://en.wikipedia.org/wiki/Caesar_cipher) of the pattern $P$ in the text $T$. The problem can be solve using the following two methods:
- By $\text{KM... |
Simultaneous matching of all Caesar rotations of a pattern in a text |
Suppose we have an alphabet of size $S$, a pattern of length $P$ and a text of length $T$. We want to design an algorithm for matching all [caesar rotations](https://en.wikipedia.org/wiki/Caesar_cipher) of the pattern $P$ in the text $T$. The problem can be solved using the following two methods:
- By $\text{KMP/Z... |
I am trying to design an algorithm. For now, I am trying to give myself a large overview.
Assume I have `K` (for example, `K` can equal 8) perfect slave machines, and one master machine. Each slave has a perfect HDD. I want to save the string "ABCDEFGHIJKLMNOP". My wished are
1. I want to only save a fragment o... |
How can a fault tolarent Distributed Data Saving Algorithm can be developed? |
|error-correcting-codes|algorithm-design| |
Use [secret sharing](https://en.wikipedia.org/wiki/Secret_sharing). With a $k$-out-of-$n$ secret sharing scheme, the string is distributed among $n$ "slaves". Access to any $k$ "slaves" is enough to recover the string; but with access to $k-1$ or fewer "slaves", an adversary cannot learn anything about the string.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.