instruction stringlengths 0 29.8k ⌀ |
|---|
null |
Can Rural Postman Problem with arbitrary start and end be reduced to Rural Postman Problem with single depot node?
The rural postman problem is:
*Given a weighted MultiDiGraph $G=(V,E)$, a subset of edges $A$ must be traversed. The path must start and end at the depot node. Find the shortest of all such path... |
I am learning about Fibonacci heaps from the following set of notes: http://staff.ustc.edu.cn/~csli/graduate/algorithms/book6/chap21.htm. There are 2 things that are confusing me.
Firstly, in the consolidate function, the author has created an array of size D(n), where D(n) is the maximum number children of a root ... |
Two Questions About Fibonacci Heaps |
|data-structures|heaps| |
null |
In [1], it states that checking $f(..., x_i, ..., \bar{x}_j, ...) = f(..., \bar{x}_j, ..., x_i, ...)$ (variables $x_i$ and $x_j$ are E-symmetric) is equivalent to checking $f_{x_ix_j} = f_{\bar{x}_i\bar{x}_j}$. I am having trouble proving this statement.
Using Boole's expansion theorem, we can write Boolean functio... |
Equivalent-symmetric (E-symmetric) variables check for Boolean functions |
|boolean-algebra| |
I'm trying to figure out if it something that I can say for every 2 languages:
is Reduction from RE\R to coRE\R always not possible, and why?
(some thoughts about it: this reduction might be possible when for given language L it's both in RE and both in coRE (meaning it's in R, but when it's RE\R and coRE\R, it ... |
is Reduction from RE to coRE possible? |
|computability| |
Let the *rural postman problem without depot node* be denoted by $\textrm{RND}$
and the *rural postman problem with depot node* be denoted by $\textrm{RD}$.
Let $G = (V,E,w)$ be a positive weighted graph instance of $\textrm{RND}$. Add a new vertex $d$ to the graph. Add directed edges $(s,v)$ and $(v,s)$ for each v... |
null |
$D(n)$ is the maximum possible degree of a root node in the *final* heap after the consolidate operation. Specifically, $D(n) = \left\lceil \log_2 n \right\rceil$.
Note that real implementations usually use an array that is the size of the machine word in bits; that would be 64 on 64-bit machines. |
For the previously interested and for those to come, I'd recommend reading through this: https://arxiv.org/abs/1812.09764. The authors open-source their code as well. AFAIK, this is limited to feed-forward networks. |
1) Without this step, you are not actually going through a "DFS". You would still be visiting all the nodes, however. Have a look at the example below:
[![Image describing situation][1]][1]
You can see that the order in which one marks nodes as visited in an iterative DFS matters. In the image, by following the a... |
null |
null |
How would you choose the second hash function with for double hashing with string as key?
My first hash function is the scalar product of a random int array with the 16 bit number of each character.
Is that a good first hash function? And what should I do for the second function now?
thanks in advance. |
null |
How would you choose the second hash function with for double hashing with string as key?
My first hash function is the scalar product of a random int array with the 16 bit number of each character.
Is that a good first hash function? And what should I do for the second function now? |
Is it true that for every Turing machine , there exists a circuit ensemble such that () = (), or is it true that for every circuit ensemble , there exists a Turing machine such that () = ()?
Initially, I believed that the first statement was true because a Turing machine can simulate any circuit ensemble. However,... |
Computational power of Turing machines vs circuit ensemble |
|turing-machines|computation-models|circuits| |
Is it true that for every Turing machine , there exists a circuit ensemble such that () = (), or is it true that for every circuit ensemble , there exists a Turing machine such that () = ()?
Initially, I believed that the second statement was true because a Turing machine can simulate any circuit ensemble. However... |
You have to define what you mean by "response time".
Let's suppose we have a client sending a request to a server over a network, and the server sending back a response. What is the time it takes from when the client has the request to when it receives the response? Well, there likely is the time the request spend... |
null |
I heard the terms "theorem provers" and "proof assistants" tossed around before (which I assumed to be the same up until a couple seconds ago), and also of Coq, Idris, Agda, TLA+ (don't know which aforementioned camps they belong to), but are completely clueless where I should begin to verify a formal proof programmati... |
How to start with verifying a formal proof programmatically? |
|formal-methods|proof-assistants|automated-theorem-proving|interactive-proof-systems| |
I heard the terms "theorem provers" and "proof assistants" tossed around before (which I assumed to be the same up until a couple seconds ago), and also of Coq, Idris, Agda, TLA+ (don't know which aforementioned camps they belong to), but are completely clueless where I should begin to verify a formal proof programmati... |
Let $W$ be a subspace of $V = (\mathbb{Z}/2\mathbb{Z})^n$ and $\dim(W) = k$. For $v \in V$, define the distance from $v$ to $W$ to be $d(v,W):=\min_{w\in W} d(v,w)$ where $d(v,w)$ is the Hamming distance.
Given such a subspace $W$, how can I find a vector $v \in V$ such that $d(v,W)$ is as large as possible?
The ... |
Finding a vector of maximum Hamming distance from a subspace of $(\mathbb{Z}/2\mathbb{Z})^n$ |
|algorithms|optimization|satisfiability|linear-algebra|hamming-distance| |
Your this claim: "*When algorithm uses "even way" the optimization doesn't change logic and result*" is incorrect.
Since the "even way" is dependent on the "odd way" (due to recursive dependency), the optimization does changes the logic and result.
For example, consider the following example when optimized algori... |
Your this claim: "*When algorithm uses "even way" the optimization doesn't change logic and result*" is incorrect.
Since the "even way" is dependent on the "odd way" (due to recursive dependency), the optimization does change the result.
For example, consider the following example when optimized algorithm is used... |
I heard the terms "theorem provers" and "proof assistants" tossed around before (which I assumed to be the same up until a couple seconds ago), and also of Coq, Idris, Agda, TLA+ (don't know which aforementioned camps they belong to), but are completely clueless where I should begin to verify a formal proof programmati... |
null |
Let the *rural postman problem without depot node* be denoted by $\textrm{RND}$
and the *rural postman problem with depot node* be denoted by $\textrm{RD}$.
Let $G = (V,E,w)$ be a positive weighted graph instance of $\textrm{RND}$. Add a new vertex $d$ to the graph. Add directed edges $(s,v)$ and $(v,s)$ for each v... |
null |
null |
Let P be the space of all possible planar graphs.
Fact: A planar graph may have multiple duals based on its embedding.
Let $D_p$ be the set of all possible duals of a planar graph $p\in P$
Let S be the space given by union of $D_p$ for all $p \in P$
Is S = P ? |
Is the set of all duals same as the set of all planar graphs? |
|graphs|planar-graphs| |
When dealing with a Recursive Backtracking Algorithm what are the ways to speed it up and what computational hardware is involved?
I'm assuming from ignorance that everything is done by the CPU so the only thing that comes to mind to make it faster would be early exits, multithreading or quantum computing.
Is tha... |
Let P be the space of all possible planar graphs.
Fact: A planar graph may have multiple duals based on its embedding.
Let $D_p$ be the set of all possible duals of a planar graph $p\in P$
Let S be the space given by union of $D_p$ for all $p \in P$
Is $S = P ?$ |
If the dual of the dual of a planar graph is isomorphic to the original graph, then yes, it must be. Let $G$ be a planar graph and $G^*$ its dual. Then, since $G^*$ is a planar graph, then $G^{**}$ is its dual. Therefore, any graph $G$ that is planar or the dual of a planar belongs in both $S$ and $P$:
If $G \in ... |
null |
null |
Problem originally from: https://train.nzoi.org.nz/problems/1311
Emma is a massive nuisance at school by always meddling around with the light switches. Each day, she goes to toggle a selection of the school's N light switches, numbered from 1 to N. If the selected switch is originally on, she turns it off, and if i... |
Harder variation of light bulb problem |
|algorithms|discrete-mathematics| |
Problem originally from: https://train.nzoi.org.nz/problems/1311
Every light-bulb is initially off, and O(N^2) solutions are too slow.
Emma is a massive nuisance at school by always meddling around with the light switches. Each day, she goes to toggle a selection of the school's N light switches, numbered from 1 ... |
Harder variation of light bulb problem (solvable in O(n log n)?) |
I think you pretty much got it there. There really aren't many ways to improve it, our best method is a slow one! (though our human brains instinctively would love to find something better for such a simple problem)
Though I'm imagining, when I think of recursive back-tracking, I think of an algorithm to solve a rub... |
I think you pretty much got it there. There really aren't many ways to improve it, our best method is a slow one! (though our human brains instinctively would love to find something better for such a simple problem)
Though I'm imagining, when I think of recursive back-tracking, I think of an algorithm to solve a rub... |
As we can visualize and listen to a sorting algorithm sorting an array, does exist an algorithm that can generate any set of notes? More precisely, does exist a sorting algorithm so that exists a program given a set of notes to give us an array so we can hear that set of notes by sorting that generated array with the a... |
Is there any sorting algorithm that can generate all the sets of notes? |
|sorting| |
You are given the `root` of a binary search tree (BST) and an integer `val`.
Find the node in the BST that the node's value equals `val` and return the subtree rooted with that node. If such a node does not exist, return `null`.
I have came up with a recursive solution in python, but I also want to document down ... |
Is my mathematical representation of search in binary search tree correct? |
|algorithms|data-structures|trees|recurrence-relation|recursion| |
I would like to minimize the [![enter image description here][1]][1] term where J_l and h_l are random numbers and L=10. Can somebody help me to solve the problem?
[1]: https://i.stack.imgur.com/iKRku.jpg |
Minimizing a sum of trigonometric functions |
|optimization|numerical-algorithms| |
null |
null |
Your conclusion "then all numbers have the same $k$ values" is not justified. The samples are anywhere in $[0,1)$ and can fall in any slot.
Uniformly means that in the long run, all slots will be filled in a balanced way. (The $\text{pdf}$ of $k$ is continuous and constant. The expectation of the filling of any bin ... |
Let $W$ be a subspace of $V = (\mathbb{Z}/2\mathbb{Z})^n$ and $\dim(W) = k$. For $v \in V$, define the distance from $v$ to $W$ to be $d(v,W):=\min_{w\in W} d(v,w)$ where $d(v,w)$ is the Hamming distance.
Given such a subspace $W$ (more precisely, receiving a basis of $k$ vectors as input), how can I find a vector $... |
null |
Let $W$ be a linear subspace of the vector space $V = (\mathbb{Z}/2\mathbb{Z})^n$. Let $k = \dim(W)$. For $v \in V$, define the distance from $v$ to $W$ to be $d(v,W):=\min_{w\in W} d(v,w)$ where $d(v,w)$ is the Hamming distance.
Given such a subspace $W$ (more precisely, receiving a basis of $k$ vectors as input),... |
null |
This depends greatly on what "reducible" means.
- If we mean *Turing reducible*, then every set (trivially) Turing-reduces to its complement, so in particular each r.e. set reduces to a co-r.e. set.
- If we mean *many-one reducible*, on the other hand, then **no** properly r.e. (= r.e. and not recursive) set re... |
I heard the terms "theorem provers" and "proof assistants" tossed around before (which I assumed to be the same up until a couple seconds ago), and also of Coq, Idris, Agda, TLA+ (don't know which aforementioned camps they belong to), but are completely clueless where I should begin to verify a formal proof programmati... |
I have a problem domain that has several kinds of symmetries. I will try to keep this as general as possible. Given an array of strings:
["4533", "1234", ...]
The two symmetries that I have in the problem is that you can permute any two "columns", for example "123" is equivalent to "213" (all strings are the same... |
Efficient way of exploiting many symmetries |
|algorithms|sorting| |
null |
Let $P$ be the space of all possible planar graphs.
Fact: A planar graph may have multiple duals based on its embedding.
Let $D_p$ be the set of all possible duals of a planar graph $p\in P$
Let $S$ be the space given by union of $D_p$ for all $p \in P$
Is $S = P ?$ |
null |
null |
null |
Let us consider a shortest path problem with weights $w_e$ for each edge $e$. It can be formulated as a linear program (LP).
\begin{align}
\min \quad &\sum_{e \in E} w_e x_e \\
s.t. \quad & A_f x_e = b_f \\
& x_e \in \{0,1\}
\end{align}
Here, $A_f, b_f$ are the flow conservation constraints. It is know... |
Solving shortest path with negative weights with linear program. What is the underlying problem we want to solve? |
|shortest-path|linear-programming|network-flow| |
Let us consider a shortest path problem with weights $w_e$ for each edge $e$. It can be formulated as a (integer) linear program (ILP).
\begin{align}
\min \quad &\sum_{e \in E} w_e x_e \\
s.t. \quad & A_f x_e = b_f \\
& x_e \in \{0,1\}
\end{align}
Here, $A_f, b_f$ are the flow conservation constraints.... |
Let us consider a shortest path problem with weights $w_e$ for each edge $e$. It can be formulated as a (integer) linear program (ILP).
\begin{align}
\min \quad &\sum_{e \in E} w_e x_e \\
s.t. \quad & A_f x_e = b_f \\
& x_e \in \{0,1\}
\end{align}
Here, $A_f, b_f$ are the flow conservation constraints.... |
null |
Let $W$ be a linear subspace of the vector space $V = (\mathbb{Z}/2\mathbb{Z})^n$. Let $k = \dim(W)$. For $v \in V$, define the distance from $v$ to $W$ to be $d(v,W):=\min_{w\in W} d(v,w)$ where $d(v,w)$ is the Hamming distance.
Given such a subspace $W$ (more precisely, receiving a basis of $k$ vectors as input),... |
I'm studying this myself and I think the only essential distinction between K and J is that:
- The user of K is expected to provide a type `P : x ≡ x → Set` depending on some loop about `x` (a closed path).
- The user of J is expected to provide a type `Q : (y : A) → x ≡ y → Set` depending on a general path that ... |
null |
null |
Thanks to Vladislav Bezhentsev, and another article I read online, I now have a solution which is O(N * max(p_i)).
The way this works, is, there might be 50k different combinations of K, and P given. But P is at most 50. So, previously we were doing 50k for loops simulating turning on/off light bulbs.
But now, we... |
The upper bound (worst - case senario) is when there are 1 or 0 positive numbers in the array because the algorithm will terminate only when i is equal to the number of elements of the array. In this case the time complexity is O(n^2) because there is a nested loop. So for i = 0 ther will be n-1 comparisons for i = 1 n... |
in my opinion it is quite difficult to answer your question because it is very broad.
However, I'll try point out several facts that might help you choose the course of action. I will cite the PAs I know or have been working with.
You correctly stated that mechanical theorem provers (MTPs) are proof assistants (PAs... |
in my opinion it is quite difficult to answer your question because it is very broad.
However, I'll try point out several facts that might help you choose the course of action. I will cite the PAs I know or have been working with.
You correctly stated that mechanical theorem provers (MTPs) are proof assistants (PAs... |
null |
Your problem is very likely NP-hard. If you don't add the restriction that $W$ is sub-space, but just receive a set of boolean vectors $W$, then it is NP-hard and known as a *Covering Radius* [proven NP-hard by Frances and Litman][1]. Of course it might be that $W$ being a sub-space somehow makes the problem easier, bu... |
It's important to understand that the field of "computability", together with its vocabulary and formalisms, wasn't a thing in Turing's time.
Also, when introducing his machines, he was not trying to come up with a "computer architecture" in the sense understood today, planning a machine that you can build for probl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.