instruction stringlengths 0 29.8k ⌀ |
|---|
*[EDIT: updated to apply to undirected graphs]*
**Lemma 1.** *The general problem (with $r$ given as input) is solvable in polynomial time.*
*Proof.* 1. Fix a problem instance $(G=(V, E), s, t)$.
For brevity, define an *$r$-cut* to be any edge subset $C\subseteq E$
such that every $s$-$t$ path contains at leas... |
My textbook (Saurabh's *Introduction to VLSI Design Flow*) mentions while discussing formal verification that a representation of a Boolean function is said to be canonical if the following holds:
> If a representation is canonical, then the two functionally equivalent functions are represented identically. Converse... |
null |
I need help with this question. If it’s possible to do this without limits, please show. Thanks.
Q: If f(n) is Ω(n) and g(n) is O(n), then prove or disprove the following statement: f(n) is O(n) |
Proving a function of asymptotic Notation |
|algorithm-analysis|asymptotics|functional-programming| |
I am a high school student who is very interested in computer science and has been studying it since middle school. I've heard a lot of news about the rise in computer science majors in college and how that affects school acceptance rates. Should I be worried about this and how it'll affect my college application expe... |
Should upcoming computer scientists be worried about the rising competition in the field? |
|education| |
null |
null |
What’s the solution for N = 12m + 2, 3, 5, 6, 7, 8, 10, 11?
You can prove that no solution exists or find a solution in O(log N). You can find the smallest solution in O(log N log log N) or more precisely in the time it takes to multiply numbers of log N digits. |
If you want to maximize your chances of admission, I suggest that you:
- Take the maximum number of computer science classes that you can.
- Take the maximum number of math classes you can. Take the most advanced math classes you can. For instance, if you have a chance to take AP calculus, do that.
Obvious... |
Suppose $f(n) = n^2$. Clearly, we have $f(n) \in \Omega(n)$ but $f(n) \notin O(n)$. It does not require the information given for $g(n)$.
Had the quotation been to prove/disprove $f(n) \in O(g(n))$, we could proceed as follows:
Take $f(n) = n^2$ as before, along with $g(n) = \log n$. This satisfies the required c... |
If we have a finite (directed) graph G, and a set of paths P in G. And assume that there exists and n so that all walks of lengths greater than n have at least one p in P as subpath, how would be find n? Does anyone know a polynomial time algorithm in |G|?
For example if we have the graph
1 -> 2 -> 3 -> 4
and ... |
How to find smallest n so that all walks of length greater or equal to n include set of paths |
In a [CP-algorithms](https://cp-algorithms.com/graph/second_best_mst.html) wiki *Second Best Minimum Spanning Tree - Using Kruskal and Lowest Common Ancestor*:
> Let $T$ be the Minimum Spanning Tree of a graph $G$ . It can be observed, that the second best Minimum Spanning Tree differs from $T$ by one edge repla... |
Distinct edge weights assumption in second best MST algorithms only replacing an edge in MST |
There is a proof on the internet without distinct edge weights assumption found in this [document](https://drive.google.com/file/d/1bMWPiTmiMnutCYv7QGQ0oXK9Lf0SDwDs/view?pli=1) from flashmt's comment in [codeforces](https://codeforces.com/blog/entry/23148?f0a28=1). It is the equivalent of the proof provided, only writt... |
In a [CP-algorithms](https://cp-algorithms.com/graph/second_best_mst.html) wiki *Second Best Minimum Spanning Tree - Using Kruskal and Lowest Common Ancestor*:
> Let $T$ be the Minimum Spanning Tree of a graph $G$ . It can be observed, that the second best Minimum Spanning Tree differs from $T$ by one edge repla... |
null |
i have seen some articles where they use the diagonalization argument to prove the existence of non-primitive recursive functions. But this should only work if we can create an infinite list of every possible primitive recursisve function in a computable way, like say for eg we should be able to find the output of nth ... |
can we computably list every primitive recursive function? |
|algorithms|proof-techniques|primitive-recursion| |
null |
A caterpillar is a subgraph which consists of a path with at most four leaves (legs) attached to each node (but a node can also have no leaves). This is not the same as finding the longest path, because we measure the number of vertices (including the legs), not the length. Find an algorithm with time complexity of O(n... |
How to find largest caterpillar in a tree |
|algorithms|graphs|trees|search-algorithms|graph-traversal| |
null |
Hint: the heaviest caterpillar going through a node is
- the weight of the heaviest non-leaf child if it exists, plus
- the weight of the second heaviest non-leaf child if it exists, plus
- the number of leaves attached to this node capped at 4, plus
- 1 for the node itself.
You can compute this inductively us... |
{"Voters":[{"Id":22714,"DisplayName":"orlp"}],"DeleteType":1} |
Hint: the heaviest caterpillar that can be formed by a path starting at a node and moving strictly downward in the tree (its down-weight) is
- the down-weight of the heaviest non-leaf child if it exists, plus
- the number of leaves attached to this node capped at 4, plus
- 1 for the node itself.
Then the heavie... |
{"Voters":[{"Id":22714,"DisplayName":"orlp"}]} |
null |
null |
Silberschatz defined "logical address" as the address leaving the CPU. In this case, the address leaving the CPU is the same as the address sent to memory. But in execution-time binding, the addresses may differ. |
null |
For any set of strings A, define the set FirstHalves A = {x∣∃y such that len(y) = len(x) and xy in A }. For example, FirstHalves {01, 111, 1010, 001101, 1011} = {0, 10, 001}, ie the first halves of the even length strings.
Let B = {01, 011, 0111, 01111, 011111, ...}.
What is the set FirstHalves B? You can simply w... |
What is the set FirstHalves B? You can simply write out the set explicitly, enumerating the first four values |
|complexity-theory|finite-automata| |
null |
As the title says, the question is about finding the maximal bottleneck edge in path P.
Bottleneck of a path P in an undirected graph G = (V,E) is defined to be the weight of the edge with minimal weight on P. Given a graph G and s,t in V, find the path between s and t with the **maximal** bottleneck. In other words, ... |
Prove that the a bottleneck of path P is maximal |
|weighted-graphs|minimum-spanning-tree|spanning-trees| |
null |
As the title says, the question is about finding the maximal bottleneck edge in path P.
Bottleneck of a path P in an undirected graph G = (V,E) is defined to be the weight of the edge with minimal weight on P. Given a graph G and s,t in V, find the path between s and t with the **maximal** bottleneck. In other words, ... |
Given a $n \times n$ matrix $M$ of positive integers and a constant $d$. If $R,C \subset \{1,...,n\} $ let $$S_M(R,C) = \sum_{r \in R,c \in C }M_{i,j} $$
I want to find the sets $$R,C \subset \{1,...,n\}, |R|,|C| = d $$ such that $S_M(R,C)$ is as big as possible.
I suspect this to be a known problem. I am wonder... |
Given a $n \times n$ matrix $M$ find a subset of d rows and d columns so that the sum of the elements in their intersection in maximized |
|algorithms|dynamic-programming|matrices| |
Given $\{\rho_i,v_i\}_{i=1}^N$, the densities and volumes of $N$ items, and $K\in \mathbb{Z}_+$. Let $v_0=1$ be the initial volume, and the initial mass is zero. The values $\rho_i,v_i\in \mathbb{R}_+$. For $S\subseteq [N]$, the corresponding average density is
$$d(S):=\frac{\sum_{i\in S} \rho_i v_i}{v_0+\sum_{j\in S... |
Maximum density knapsack with initial volume and constraint on number of items |
|dynamic-programming|knapsack-problems| |
Let $G=(V,E)$ be an unweighted directed acyclic graph with a set $V$ of vertices and a set $E$ of edges. The all-pairs shortest path problem can be solved efficiently using the Floyd-Warshall algorithm. The new objective is to find a subset of maximum cardinality $S \subseteq V$ such that for every pair of vertices $v$... |
Maximum Vertex Set With a Minimum Pairwise Distance Requirement in Directed Acyclic Graphs |
|graphs|np-complete|dynamic-programming|dag| |
null |
null |
It is NP-hard, by reduction from the [maximum balanced biclique problem](https://arxiv.org/pdf/2007.08836.pdf).
Suppose you have a bipartite graph $G$, and the goal is to test whether there is a balanced biclique of size $d$. Let $M$ denote the adjacency matrix of $G$. Then there is a balanced biclique of size $d$... |
Your first answer appears to be correct. I think the other source is wrong. In particular, 011 is in FirstHalves B because 011111 is in B. |
I have two 64-bit numbers `a` and `b` which have a few properties: only 49 out of the 64 bits are used, and the two number's binary representations are disjoint (`a & b == 0`). I am looking for a good way to hash the two numbers together into a deterministic 64-bit integer.
Tabular hashing with randomly generated ke... |
A good way to hash two numbers with known properties together |
|hash|binary| |
Normally comparing objects involves comparing subobjects that can be compared and hashed, you write a good hash function once that combines hash values and use that everywhere and never worry about the problem anymore.
In your case, you might calculate hash(a or b) or hash (a ^ b) or hash (a + b). However, six mont... |
I have two 64-bit numbers `a` and `b` which have a few properties: only 49 out of the 64 bits are used (15 bits are always 0), and the two number's binary representations are disjoint (`a & b == 0`). I am looking for a good way to hash the two numbers together into a deterministic 64-bit integer.
Tabular hashing wit... |
I don't know of a good way to use your special properties. But I do know a very fast provably good hash.
Choose three random 64-bit integers $x, y, z$ (which must be independent of your input $a, b$). Then the following function $h$:
$$h(a, b) = xa + \lfloor ya / 2^{64}\rfloor + yb + \lfloor zb / 2^{64}\rfloor ... |
Let $G=(V,E)$ be an unweighted directed acyclic graph with a set $V$ of vertices and a set $E$ of edges. The all-pairs shortest path problem can be solved efficiently using the Floyd-Warshall algorithm. The new objective is to find a subset of maximum cardinality $S \subseteq V$ such that for every pair of vertices $v$... |
Let $G=(V,E)$ be an unweighted directed acyclic graph with a set $V$ of vertices and a set $E$ of edges. The all-pairs shortest path problem can be solved efficiently using the Floyd-Warshall algorithm. The new objective is to find a subset of maximum cardinality $S \subseteq V$ such that for every pair of vertices $v$... |
Let $G=(V,E)$ be an unweighted directed acyclic graph with a set $V$ of vertices and a set $E$ of edges. The all-pairs shortest path problem can be solved efficiently using the Floyd-Warshall algorithm. The new objective is to find a subset of maximum cardinality $S \subseteq V$ such that for every pair of vertices $v$... |
I have a system in which I need to be able to calculate the week number and day number from any Monday to the current date. Weeks can only be 1-4, then it starts over. So, if we are 5 weeks from the "Monday start date", then we're actually on Week #1 again. Days can only be 0-6. 1 = Monday, etc. Start date must always ... |
Algo for 4-week rolling date calcs? |
|algorithms|mathematical-programming| |
Consider a quadratic function over positive integers. For example say a simple function of the form: $f(n)=3n+4n^2$
Now given any positive integer $C$ find two integers such that: $f(i)-f(j) = C$
What is the complexity of such problems? I tried searching for a bit but didn't find an answer.. |
What is the Computational Complexity of this Difference of Squares problem? |
|algorithms|complexity-theory| |
I'd point to Section 8.3 of [Fukuda's lecture notes][1] for this topic. (Long story short, the dimension of a polyhedron that lives in $d$ dimensions can be computed via $d$ linear programs.)
[1]: https://people.inf.ethz.ch/~fukudak/lect/pclect/notes2015/PolyComp2015.pdf |
null |
For refresher, let's first remember ([Wikipedia](https://en.wikipedia.org/wiki/Conjunctive_normal_form#Definition)) that we can convert any Boolean expression into conjunctive normal form, which is defined as conjunction ("AND" $\land$) of one or more disjunctions ("OR" $\lor$) of one or more literals, and governed by ... |
For refresher, let's first remember ([Wikipedia](https://en.wikipedia.org/wiki/Conjunctive_normal_form#Definition)) that we can convert any Boolean expression into conjunctive normal form, which is defined as conjunction ("AND" $\land$) of one or more disjunctions ("OR" $\lor$) of one or more literals, and governed by ... |
(22)10 - (65)10= (?)2
Perform this operation using 2's compliment method.Use 8bit representation of numbers
|
Binary subtraction using two's compliment |
|binary| |
As signed 8-bit numbers 22 is 00010110 and 65 is 01000001. To do subtraction you just use two's complement of what you are subtracting by, which is the same as just inverting it and adding 1. So 01000001 (65) would become 1011111**1**. Now let's add 00010110 (22) and 10111111.
```
¹¹¹¹¹
00010110
+ 10111111
-... |
I'm a new professor and working at a computer science college. I'm going to be responsible for giving a one-hour lecture to motivate my students to study automata groups.
I'm very experienced as a teacher and I think that I'm a really good speaker, but no idea about how to make these topics friendly and attractive ... |
How to motivate freshman students towards automata groups? |
|automata|cellular-automata|group-theory| |
null |
If we have a finite (directed) graph G, and a set of walks P in G. And assume that there exists an n so that all walks of lengths greater than n have at least one p in P as subpath, how would we find n? Does anyone know a polynomial time algorithm in |G|?
For example if we have the graph
1 -> 2 -> 3 -> 4
and P... |
Let $G=(V,E)$ be an unweighted directed acyclic graph with a set $V$ of vertices and a set $E$ of edges. The all-pairs shortest path problem can be solved efficiently using the Floyd-Warshall algorithm. The new objective is to find a subset of maximum cardinality $S \subseteq V$ such that for every pair of vertices $v$... |
Given $N$ a whole number and a set $S$ of divisors of N, where no repetition is allowed. Decide if there is a combination of divisors with a product equal to $N$.
- Remove non-divisors from $S$.
- Remove duplicates from S by using set() in python.
- Treat $S$ as list of non-duplicates and sort from smallest to ... |
If this variant of Subset Product remains NP-complete, what other inputs could give me exponential time? |
|time-complexity|np-complete|subset-product| |
Look at the construction for $Y = λf·(λx·f (x x))(λx·f (x x))$. Carefully apply the type rules to it
$$\begin{align}
f:& C → A,\\
x:& B → C,\\
x:& B,\\
x x:& C,\\
f (x x):& A,\\
λx·f (x x):& B → A,\\
λx·f (x x) (λx·f (x x)):& A,\\
λf·(λx·f (x x) (λx·f (x x))):& A → A,
\end{align}$$
where, in order to make th... |
Given $N$ a whole number and a set $S$ of divisors of N, where no repetition is allowed. Decide if there is a combination of divisors with a product equal to $N$.
- Remove non-divisors from $S$.
- Remove duplicates from S by using set() in python.
- Treat $S$ as list of non-duplicates and sort from smallest to ... |
I'm a new professor and working at a computer science college. I'm going to be responsible for giving a one-hour lecture to motivate my students to study [automatic groups][1].
I'm very experienced as a teacher and I think that I'm a really good speaker, but no idea about how to make these topics friendly and attra... |
How to motivate freshman students towards automatic groups? |
|automata|cellular-automata|group-theory| |
{"OriginalQuestionIds":[167227],"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
null |
There is no way this is at an appropriate level for students just graduating from high school. Save it for much more advanced students. It requires considerable mathematical sophistication -- and probably understanding of what automata area -- even to understand what an automatic group is and why one should care abou... |
Given $N$ a whole number and a set $S$ of divisors of N, where no repetition is allowed. Decide if there is a combination of divisors with a product equal to $N$.
- Remove non-divisors from $S$.
- Remove duplicates from S by using set() in python.
- Treat $S$ as list of non-duplicates and sort from smallest to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.