instruction stringlengths 0 29.8k ⌀ |
|---|
The tight bound on the number of decycling sets is $2^{\Theta(|V|)}$. Consider the following $3$-regular planar graph.
[![enter image description here][1]][1]
In the decycling set, for each $i \in \{1,\dotsc,n\}$ choose either $a_i$ or $b_i$. Moreover, choose the vertex $c_n$ in the decycling set. Note that remo... |
The usual rule on this site is to ask only one question per post, so I'll answer the first question. Specifically, I'll focus on the case where there is only one discount rule, and it can only be applied once. In that case, the problem can be solved with a greedy algorithm:
- Let $n_a := a, n_b := b, n_x := 0... |
null |
I am having great difficulty following the proof in class. I assume "optimal" means it minimizes the Average bit length to encode an alphabet with known frequencies. My understanding of how the algorithm works is by building a tree in a "bottom up" fashion. The least frequent alphabets are at the bottom and fused into ... |
What are the steps to create an intuitive and straightforward proof of the optimality of Huffman coding? |
|correctness-proof|information-theory|data-compression|huffman-coding| |
I am having great difficulty following the proof in class. I assume "optimal" means it minimizes the Average bit length to encode an alphabet with known frequencies. My understanding of how the algorithm works is by building a tree in a "bottom up" fashion. The least frequent alphabets are at the bottom and fused into ... |
Consider the problem of minimizing the checkout price of a shopping basket in the presence of some discount rules:
There are $n \gt 0$ distinct products in our shopping basket. Each product is associated with a price $price_i \geq 0$ and a quantity $quantity_i \gt 0$. Without applying any discounts, the checkout pri... |
null |
Optimal tree means it has the minimum bit length. Hoffman trees are an example of Optimal trees (in fact Hoffman can produce different optimal trees using tie breaking rules) but there are also optimal trees that are non Hoffman where the least frequency nodes are not at the deepest depth and yet end up having the same... |
If we have some function, $f$ with an exponentially sized domain, mapping the set $\{0, 1\}^N$ to $\{0, 1\}$, could we do something like this:
For ease, let's say $E(x) = x^e (\text{mod} \; n)$. This is the encryption function.
Now, let's say we represent $f$ with some $x$. I'm not exactly sure how this can be do... |
Converting encrypted messages to unencrypted results of an equally hard to reverse function |
|time-complexity|cryptography|encryption| |
If we have some function, $f$ with an exponentially sized domain, mapping the set $\{0, 1\}^N$ to $\{0, 1\}$, could we do something like this:
For ease, let's say $E(x) = x^e (\text{mod} \; n)$. This is the encryption function.
Now, let's say we represent $f$ with some $x$. I'm not exactly sure how this can be do... |
If we have some function, $f$ with an exponentially sized domain, mapping the set $\{0, 1\}^N$ to $\{0, 1\}$, could we do something like this:
For ease, let's say $E(x) = x^e (\text{mod} \; n)$. This is the encryption function.
Now, let's say we represent $f$ with some $x$. I'm not exactly sure how this can be do... |
null |
Yes, this is possible. Let $U$ be a universal circuit, so that $U(f,v)=f(v)$. (There will be some upper limit on the size of circuit $f$ that is supported by $U$. Presumably that will be OK.) Then you can use [homomorphic encryption](https://en.wikipedia.org/wiki/Homomorphic_encryption) to encrypt $f$ and then comp... |
Yes, this is possible, if you're willing to involve the holder of the private key. Let $U$ be a universal circuit, so that $U(f,v)=f(v)$. (There will be some upper limit on the size of circuit $f$ that is supported by $U$. Presumably that will be OK.) Then you can use [homomorphic encryption](https://en.wikipedia.o... |
null |
It is pretty well taught that any binary function can be represented using CNF. But conversion to CNF can take an exponential number of gates. The truth table is exponentially sized relative to the number of input variables.
Is there any form of representing logical circuits that requires only a polynomial or quasip... |
Representing functions without exponential blow-up? |
|logic|circuits|boolean-algebra| |
Representing binary functions with a finite gate set without exponential blow-up? |
It is pretty well taught that any binary function can be represented using CNF. But conversion to CNF can take an exponential number of gates. The truth table is exponentially sized relative to the number of input variables.
Is there any form of representing truth tables that requires only a polynomial or quasipolyn... |
I need to find an algorithm for a modified version of the [stable marriage problem][1]. In particular, I need to find all possible stable matchings and not only one (unlike what the Gale-Shapley algorithm does). The only solution I have is to recursively enumerate all the possible matchings, discarding the recursive br... |
Finding all stable matchings in stable marriage problem |
|algorithms|complexity-theory|np-hard|combinatorics|matching| |
I need to find an algorithm for a modified version of the [stable marriage problem][1]. In particular, I need to find all possible stable matchings and not only one (unlike what the Gale-Shapley algorithm does). The only solution I have is to recursively enumerate all the possible matchings, discarding the recursive br... |
Finding all stable matchings in stable marriage problem |
|algorithms|complexity-theory|np-hard|combinatorics|matching| |
How is the path matrix created by the Floyd Warshall algorithm used for path lookup?
The 2 images show the graph (b) and the path matrix (c). Both are taken from the book: Foundations of Algorithms by Richard E. Neapolitan.
[![Path Matrix & The Related Graph Used To Get The Path Matrix][1]][1]
To lookup the be... |
Lookup Using Path Matrix in Floyd Warshall Algorithm |
|algorithms|graphs|optimization|shortest-path| |
null |
I'm trying to find an algorithm for this problem:
I'm going to the shop and need to buy 60 grams of X.
But the shop only sells X in these quantities:
- 50g of X
- 80g of X
- 300g of X
Which combination of products should I buy so I end up with at least 60 grams of X but I want to waste X as less as possib... |
Algorithm for optimal item selections |
|algorithms| |
null |
I'm trying to find an algorithm for this problem:
I'm going to the shop and need to buy X grams of an ingredient.
The shop does not necessarily have an "X grams of ingredient" product.
But they have N products with different weights.
Which combination of products should I buy so I end up with at least X grams... |
null |
This problem is NP-Hard by a reduction from the following version of subset sum: given a multi-set $X$ of $2n$ numbers $\{x_1, \dots, x_{2n}\}$ and a target $T$, is there a subset $X'$ of $X$ with $|X'|=n$ and $\sum_{x \in X'} =T$?
However, the problem admits a pseudopolynomial-time dynamic programming algorithm whe... |
No. No matter what representation of functions as circuits/formulas you use, there will exist some functions that require exponential size to represent. This was proven by Shannon in 1949. See https://cs.stackexchange.com/q/151372/755.
Intuitively, you can count the number of circuits/formulas of polynomial size,... |
{"OriginalQuestionIds":[162735],"Voters":[{"Id":755,"DisplayName":"D.W.","BindingReason":{"GoldTagBadge":"algorithms"}}]} |
null |
null |
Here is my code for computing the product of sequences of matrices
```
def product(A,B):
"""
Computing the product of two given matrices
Args:
- A (tuple): a matrix of size 2 x 2
- B (tuple): a matrix of size 2 x 2
Return:
- product (tuple): a product of two matrices A a... |
How to evaluate the complexity of a code |
|algorithms|complexity-theory| |
I know the title is sort of misleading because we do have set-theoretic types in several languages:) From a theoretic view, set-theoretic types such as intersection, union, and negation may bring some troubles, as the proof object they do not encode the derivation, thus making it hard to find a logical part through the... |
What is practically preventing us from applying set-theoretic types in engineering? |
|logic|type-theory| |
I know the title is sort of misleading because we do have set-theoretic types in several languages:) From a theoretic view, set-theoretic types such as intersection, union, and negation may bring some troubles, as the proof object they do not encode the derivation, thus making it hard to find a logical part through the... |
I know the title is sort of misleading because we do have set-theoretic types in several languages:) From a theoretic view, set-theoretic types such as intersection, union, and negation may bring some troubles, as the proof object they do not encode the derivation, thus making it hard to find a logical part through the... |
null |
null |
Let me first answer the easy part. The negation sign in the judgement `a : ¬ A` does not modify `:` but `A`. In particular, the standard way to define `¬ A` is to equate it with `A → ∅`.
A major obstacle to using set-theoretic semantics for a programming language is *general recursion*. Concretely, the fixed-point o... |
Let me first answer the easy part. The negation sign in the judgement `a : ¬ A` does not modify `:` but `A`. In particular, the standard way to define `¬ A` is to equate it with `A → ∅`.
A major obstacle to using set-theoretic semantics for a programming language is *general recursion*. Concretely, the fixed-point o... |
null |
null |
Suppose I have a dynamic table supporting $Insert$ procedure, which sets an input value after the tail of the dynamic table. If the underlying table is already full, we multiply its size by $q > 1$. (I have proof that that arrangement leads to amortized constant time for $Insert$: [see this post](https://cs.stackexchan... |
Proof with potential method that dynamic table with $q > 0$ expansion runs in amortized constant time |
|runtime-analysis|arrays|amortized-analysis|dynamic-array| |
Prove with potential method that dynamic table with $q > 1$ expansion runs in amortized constant time |
Suppose I have a dynamic table supporting $Insert$ procedure, which sets an input value after the tail of the dynamic table. If the underlying table is already full, we multiply its size by $q > 1$. (I have proof that that arrangement leads to amortized constant time for $Insert$: [see this post](https://cs.stackexchan... |
In non-preemptive scheduling, the running process cant be interrupted .But what will when the CPU receive a hardware interrupt such as the an interrupt from the printer indicating that the current job has been completed ? Does the CPU will preempt the current running process and handles the interrupt ( run its interru... |
What happens for hardware Interrupts in non-preemptive scheduling? |
|operating-systems|process-scheduling| |
I don't understand why you used $1$ as the non-amortized cost of a resizing.
Define $\Phi_i$ as $\frac{q^2}{q-1}$ times the number of elements inserted in the table since the last resizing. In formulas let $\Phi_i = \frac{q^2}{q-1} \cdot ( i - \frac{N_i}{q} ) = \frac{q^2}{q-1} i - \frac{q}{q-1} N_i$.
If the $i$-t... |
Recently, I began delving into complexity analysis with dictionaries. More specifically, I have been looking at auxiliary space complexity. For the most part, this type of analysis has been straightforward. For instance, suppose we have the following function ```foo```, which takes in an integer ```n```:
```
def fo... |
Auxiliary Space Complexity of Dictionaries whose Keys are Iterables of Variable Size |
|space-complexity|big-o-notation|python|dictionaries| |
null |
null |
null |
Generally, and to build upon [this](https://cstheory.stackexchange.com/q/50815/3984) discussion, there is plenty of work which describes types exactly as you'd like, that is as a collection of "values" of a certain shape, with natural set theoretic operations on them, like complement, union and intersection.
Worth r... |
Assume that you have an image that you going to classify its class ID.
One good option is to use interest points e.g FAST that can find coners/edges inside an image.
[![enter image description here][1]][1]
From these points you could classify a specific area....but how do I know which area I should classfy?
... |
What is a good appropriate algorithm for localization for images? |
|image-processing|classification| |
null |
I don't know if I asked the question in correct way but I will try to explain what's the thing I am not getting. I am currently reading book titled "Code: The Hidden Language of Computer Hardware and Software". In chapter sixteen, the book discusses structure of memory starting from latch. Following image shows 1 byte ... |
Same Address and Write signal for two block of RAM? |
|memory-hardware|memory-access| |
null |
Let $G$ be a non-commutative group, such as $\operatorname{GL}_k(\mathbb F_p)$. Given a list $\vec{a}=(a_1, \cdots, a_n) \in G^n$, we use $(p, q, x)$ to denote the operation that maps $\vec{a}$ to $(a_1, \cdots, a_{p-1}, a_p x, \cdots, a_q x, a_{q+1}, \cdots, a_n)$. Do we have an algorithm running in time complexity $O... |
Complexity of non-commutative range multiplication operation |
|algorithms|data-structures| |
You *do* write data in second block whenever you write data in 1st block of memory.
You *can* provide *independent* Data In to each block and expect it to be readable independently at the Data Outs: the second diagram depicts an 8 words of 2 bit memory.
The first one does *not* depict `1 byte of memory`... |
Say I want to build a trie out of 800,000 Sanskrit "base" words (in Devanagari script), with 20 prefixes and 2,000 possible suffixes. Each word is anywhere from 1-20 characters, and prefixes/suffixes are from 1-4 characters. The alphabet size (of the [Devanagari script](https://en.wikipedia.org/wiki/Devanagari_(Unicode... |
How to estimate the number of nodes in a trie based on a dictionary of words? |
|combinatorics|discrete-mathematics|trie| |
Yes, it can be done in $O(n \log^2 n)$ time. Build a balanced binary tree over the $n$ leaves. Store a group element in each node. Initialize the tree by storing the element $1$ in each node.
Identify each leaf with an index $j$ in the range $1 \le j \le n$. The idea is that, at any point during the execution of... |
everyone,
I was studying Paxos and Failure Detectors, and it was asked whether a failure detector W could be used to make Paxos live, but I can't figure it out.
Any suggestions? |
Can we make Paxos live with a failure detector in W? |
|distributed-systems| |
I was studying Paxos and Failure Detectors, and it was asked whether a failure detector W could be used to make Paxos live, but I can't figure it out.
Any suggestions? |
Let me first answer the easy part. The negation sign in the judgement `a : ¬ A` does not modify `:` but `A`. In particular, the standard way to define `¬ A` is to equate it with `A → ∅`.
A major obstacle to using set-theoretic semantics for a programming language is *general recursion*. Concretely, the fixed-point o... |
I would like to know if there is any research dealing with the problem of constructing an increasing family of expander graphs.
The goal is to find a family of **expander graphs** $(G_i)_{i \in \mathbb{N}} = ((V_i,E_i ))_{i \in \mathbb{N}} $ satisfying $V_1 \subseteq V_2 \ldots \subseteq V_n$ and $E_1 \subseteq E_2... |
Increasing families of expander graphs |
|graphs|expanders| |
1. Negation is certainly possible in these systems. It's discussed in the best introductory materials, in particular:
https://www.irif.fr/~gc/papers/covcon-again.pdf
https://pnwamk.github.io/sst-tutorial/
This however doesn't have anything to do with double negation elimination or classical logic.
2. As to why the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.