instruction
stringlengths
0
29.8k
⌀
|heuristics|
|optimization|reductions|satisfiability|
Consider a graph $G(V,E)$. Each edge $e$ has two weights $A_e$ and $B_e$. Find a spanning tree that minimizes $\sum_{e \in T}{A_e}\sum_{e \in T}{B_e}$. The algorithm should run in polynomial time with respect to $|V|, |E|$. I find it difficult to adapt any of the traditional algorithms on spanning trees(Kruskal, Pri...
Minimal Spanning Tree With Double Weight Parameters
|algorithms|graphs|
If the graph has non-negative edge weights, [Dijkstra's Algorithm](http://en.wikipedia.org/wiki/Dijkstra's_algorithm) will find the optimal answer in time $O(|E| + |V|\log |V|)$. However, if the graph contains negative edge weights, [Bellman-Ford's Algorithm](http://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algori...
|algorithms|graphs|shortest-path|
Consider a graph $G(V,E)$. Each edge $e$ has two weights $A_e$ and $B_e$. Find a spanning tree that minimizes the product $\left(\sum_{e \in T}{A_e}\right)\left(\sum_{e \in T}{B_e}\right)$. The algorithm should run in polynomial time with respect to $|V|, |E|$. I find it difficult to adapt any of the traditional alg...
## Single-Source-Shortest-Path ## If you have a node $s$ and want to find to some shortest path to a node $t$. If the graph has non-negative edge weights, [Dijkstra's Algorithm](http://en.wikipedia.org/wiki/Dijkstra's_algorithm) will find the optimal answer in time $O(|E| + |V|\log |V|)$. However, if the graph ...
I've been doing some reading (I'll name drop along the way) and have selected a few scattered ideas that I think could be cobbled together into a nifty esoteric programming language. But I'm having some difficulty assembling the parts. Kleene's Theorem states: Any Regular Set can be recognized by some Finite-State M...
|algorithms|graphs|shortest-path|
there is more than one way to "bound" PCP (maybe verging on many!) and there seems to be diverse research into many variants. limiting the number of concatenated blocks or total length of concatenated strings to a parameter specified on the input (specified in binary) appears to be NExpSpace complete but have not seen ...
I have a sequence of $n$ integers in a small range $[0, k)$ and all the integers have the same frequency $f$ (so the size of the sequence is $n = f * k$). What I'm trying to do now is to compress this sequence while providing random access (what is the $i$-th integer). I'm more interested in achieving high compression ...
Compression of sequence with Direct Access
|algorithms|data-compression|
there is more than one way to "bound" PCP (maybe verging on many!) and there seems to be diverse research into many variants. limiting the number of concatenated blocks or total length of concatenated strings to a parameter specified on the input (specified in binary) appears to be NExpSpace complete but have not seen ...
Ehrenfeucht, Karhumäki and Rozenberg have shown that binary PCP (where the domain is binary) is decidable. [Halava and Holub](http://www.karlin.mff.cuni.cz/~holub/soubory/Tree.pdf) later showed that it's actually in P.
there is more than one way to "bound" PCP (maybe verging on many!) and there seems to be diverse research into many variants. limiting the number of concatenated blocks or total length of concatenated strings to a parameter specified on the input (specified in binary) appears to be NExpSpace complete but have not seen ...
|probability-theory|mathematical-analysis|heuristics|statistics|
We have a set X of N elements. We want to get a new set X' having a size M < N. Choose a first element x from X and put it in X' for each element x in (X - X') Let x' the element from X' which is the closest to x (that is x' = argmin distance(x, x') for all x' in X') d = distance(x, x') ...
Both MaxSAT and MaxUNSAT are NP-complete, and so can be reduced to one another. MaxSAT is NP-hard by (trivial) reduction from SAT. To see that MaxUNSAT is NP-hard, we follow Creignou [1] and reduce from MaxCUT. Given an instance $G=(V,E)$ of MaxCUT, consider the instance $$ \bigwedge_{(x,y) \in E} (x \lor \lnot y) \la...
You can use the so-called "binomial encoding", described in one of my answers on math.stackexchange. You have to consider, though, whether it will be worthwhile. The naive encoding takes $n \log_2 k$ bits, and the best encoding saves about $O(\log n)$ bits (the best encoding uses $\log_2 \frac{n!}{f!^k}$ bits). Plug in...
Assuming P $\neq$ NP, NP-complete problems are "hard to solve, but have answers that are easy to check." Does it make any sense to consider the opposite, that is, problems for which it's easy to compute a correct answer, but hard to verify an arbitrary purported solution? I think such a problem would imply either: ...
It depends on what language you're using to do this. For instance, if this were C, I wouldn't use arrays. I would use Bitfields. Then I'd have access to Bitfield operations. Simple arithmetic is then done by using a combination of AND, OR, XOR and so on. As far as I know, your Bitfield length will still be limite...
Your method will indeed work, but for two $n$-bit numbers it will still take $O(n)$ time. There is a much faster way to solve your problem, with running time $\Theta(\log n)$, known as **carry-lookahead addition**. The downside is that in my experience teaching this technique, people have a hard time wrapping their hea...
Let $x$ and $y$ denote the two numbers and $x_i$ and $y_i$ the i-th bits in their respective binary representations. You want to determine the $i$-th bit in the binary representation of $x+y$. You are not interested in anything else. If so, proceed as follows. 1. Compute $z = x_i \oplus y_i$. 2. Examine i...
Each specific bit in the sum of two $n$-bit numbers $A=a_{n}a_{n-1}...a_{1}$ and $B=b_{n}b_{n-1}...b_{1}$ is given by the sum of the corresponding bits in the addends, plus a possible carry of $1$, modulo $2$. The carry is $1$ if the less-significant neighbor bits are $11$, or if they are $01$ or $10$ and subjected to...
I am performing addition operation on two large binary numbers having equal no of bits. I have kept both binary numbers in array of same length. No of bits is too large. Initially i was wasting time to calculate sum of both the numbers by running a loop over them and keeping track of carry bits.<br><br> Since the aim ...
Get specified bit in addition of two large binary numbers
|untagged|
|bit-operations|
Computers are a great tool for phisisians, say you want to run a simulation about a phisics phenomenon it would be useful to know the fastest algorithm avaliable, if it can be computed in a reasonable amount of time, etc. I'm a software engineer and love computer science, it's good to know what problems computers ca...
I am performing an addition operation on two large binary numbers that have an equal number of bits. Both numbers are stored in an array of length $N$, which is rather large. At first I tried running a loop over them and keeping track of carry bits. This wasted time, because the aim is to get the bit at a specific p...
|arrays|integers|binary-arithmetic|
## Single-Source-Shortest-Path ## If you have a node $s$ and want to find to some shortest path to a node $t$. If the graph has non-negative edge weights, [Dijkstra's Algorithm](http://en.wikipedia.org/wiki/Dijkstra's_algorithm) will find the optimal answer in time $O(|E| + |V|\log |V|)$. However, if the graph ...
One type of conversion is simply the reverse of the k-sat-to-3-sat conversion: **Recall, the conversion of k-sat to "j"-sat, $j<k$:** $$\begin{eqnarray*} && (x_1 \vee x_2 ... \vee x_j \vee ... \vee x_k)\\ \rightarrow && (x_1 \vee x_2 ... x_j \vee d) \wedge (\overline d \vee x_{j+1} \vee x_{j+2} ...
If you want to use JavaScript for scientific computing, why not try [Node.js][1]? Node is based on Google's V8 engine with some additional functionality for interacting with the file system, writing servers and linking to C and C++ libraries (this is definitely not an exhaustive list). It sports fast execution times an...
You can use the so-called "binomial encoding", described in one of my answers on math.stackexchange. You have to consider, though, whether it will be worthwhile. The naive encoding takes $n \log_2 k$ bits, and the best encoding saves about $O(\log n)$ bits (the best encoding uses $\log_2 \frac{n!}{f!^k}$ bits). Plug in...
null
null
What do you mean by "transitional semantics"? If you mean structural operational semantics using transition systems, then maybe a good place to start is a good text on the semantics of programming languages, Examples: * Winskel's [Formal Semantics of Programming Languages](http://www.amazon.com/Formal-Semantics-Pro...
I read in Wikipedia that unification is a process of solving the satisfability problem http://en.wikipedia.org/wiki/Unification_%28computer_science%29 At the same time, I know that such solvers are called "SAT solvers" or "SMT solvers". So, are they different names for the same thing?
Unification vs. SAT solver
|sat-solvers|unification|
I read in Wikipedia that unification is a process of solving the satisfability problem http://en.wikipedia.org/wiki/Unification_%28computer_science%29 At the same time, I know that such solvers are called "SAT solvers" or "SMT solvers". So, are they different names for the same thing? If you say that they are di...
[Unification][1] is a specific technique that takes two terms and finds a substitution that would make the terms equal. Unification is probably used somewhere SMT solvers (and maybe in SAT solvers). SAT solvers aim to solve the [Boolean Satisfiability Problem][2]. SMT solvers solve a more general problem, namely ...
SAT solvers solve the [Boolean Satisfiability Problem][2]. This is "the problem of determining if the variables of a given Boolean formula can be assigned in such a way as to make the formula evaluate to TRUE." SMT solvers solve a more general problem, namely [Satisfiability Modulo Theories][3]. This is "a deci...
SAT solvers solve the [Boolean Satisfiability Problem][2]. This is "the problem of determining if the variables of a given Boolean formula can be assigned in such a way as to make the formula evaluate to TRUE." An example is find an assignment of truth values to variables $a,b,c$ such that $(a \lor b \lor c)\lan...
When proving theorems with the superposition calculus, we deal with three kinds of rules: 1. Generating rules: from pair of clauses A and B, generate new clause C while keeping the original pair, e.g. superposition in the general case. 2. Rewriting rules: from clause A generate new clause B, e.g. equality reflexi...
Redundancy elimination in the superposition calculus
|logic|automated-theorem-proving|
SAT solvers solve the [Boolean Satisfiability Problem][2]. This is "the problem of determining if the variables of a given Boolean formula can be assigned in such a way as to make the formula evaluate to TRUE." An example is find an assignment of truth values to variables $a,b,c$ such that $(a \lor b \lor c)\land ...
SAT solvers solve the [Boolean Satisfiability Problem][2]. This is "the problem of determining if the variables of a given Boolean formula can be assigned in such a way as to make the formula evaluate to TRUE." An example is find an assignment of truth values to variables $a,b,c$ such that $(a \lor b \lor c)\land ...
I want to define a semantics of a DSL through transition semantics. For my DSL I defined the syntax and implemented a code generator. Although I can provide a demo by giving examples, I want to write the semantics of my DSL to provide a formal specification of it. However I don't know how to do it!. Can someone pro...
|algorithms|graphs|spanning-trees|
Heuristically determine a value f such that a probability d/f approaches 1/2
|complexity-theory|optimization|reductions|satisfiability|
I read on Wikipedia that [unification](http://en.wikipedia.org/wiki/Unification_%28computer_science%29) is a process of solving the satisfability problem. At the same time, I know that such solvers are called "SAT solvers" or "SMT solvers". So, are they different names for the same thing? If you say that they are...
|terminology|sat-solvers|unification|
|formal-languages|semantics|
|complexity-theory|computability|reference-request|
Doesn't that language simply recognize any string in {0,1}* that has at least 3 1's in it? If so, you just need a regular finite deterministic automaton with 3 states to identify it 1 1 1 start --> one --> two --> (three) | ^ | ^ | ^ | ^ \-/ \-/ \-/ ...
Im reviewing for my midterm and wanted to post this to see if anyone can spot any errors. Im supposed to make a PDA that recognizes this CFG: ![enter image description here][1] ![enter image description here][2] [1]: https://i.stack.imgur.com/0Dwwc.png heres my solution (note, im aware I forgot to draw th...
context free grammar to a PDA, am i correct?
|automata|
1. Why total number of leaves is `Theta(n)`? Because each level in recursion tree corresponds to a splitting of an array's range. When we have one element we can't split it any more so we stop. That's `Theta(1)` leaf. How many 1-element areas are there in an `n` element array? The answer is `n`. 2. He is summing ...
I'm going through the MIT Online Course Videos on Intro. to Algorithms at [here][1] at around 38:00. So we have a recursion formula T(n) = T(n/10) + T(9n/10) + 0(n) If we build a recursion tree it looks like T(n) -- Level 1 = c*n / ...
Finding the number of leaves in a imbalance recursion tree
|recursion|
null
think that you may be somewhat misinterpreting the point of the question. the intent of the exam question seems to be, "what good perceptron weights would result for this classification problem". the reason for this is that one cannot go through all the steps of a long-running algorithm during an exam or even homework....
think that you may be somewhat misinterpreting the point of the question. the intent of the exam question seems to be, "what good perceptron weights would result for this classification problem". the reason for this is that one cannot go through all the steps of a long-running algorithm during an exam or even homework....
think that you may be somewhat misinterpreting the point of the question. the intent of the exam question seems to be, "what good perceptron weights would result for this classification problem". the reason for this is that one cannot go through all the steps of a long-running algorithm during an exam or even homework....
think that you may be somewhat misinterpreting the point of the question. the intent of the exam question seems to be, "what good perceptron weights would result for this classification problem". the reason for this is that one cannot go through all the steps of a long-running algorithm during an exam or even homework....
I have a number of related questions about these two topics. First, most complexity texts only gloss over the class $\mathbb{NC}$. Is there a good resource that covers the research more in depth? For example, something that discusses all of my questions below. Also, I'm assuming that $\mathbb{NC}$ still sees a fa...
Some questions on parallel computing and the class NC
|complexity-theory|reference-request|parallel-computing|complexity-classes|
I have a number of related questions about these two topics. First, most complexity texts only gloss over the class $\mathbb{NC}$. Is there a good resource that covers the research more in depth? For example, something that discusses all of my questions below. Also, I'm assuming that $\mathbb{NC}$ still sees a fa...
I have a number of related questions about these two topics. First, most complexity texts only gloss over the class $\mathbb{NC}$. Is there a good resource that covers the research more in depth? For example, something that discusses all of my questions below. Also, I'm assuming that $\mathbb{NC}$ still sees a fa...
Context -- I've been programming in java for a few years now. And atm i'm learning something totally different: Clojure. There the expression problem can be solved by using multimethods whereas in java you will need something like the visitor pattern or something alike. The question -- I've been reading about m...
Difference between multimethods and overloading
|functional-programming|object-oriented|
Overloading is when two or more methods have the same name but different signature (different argument types, different number of arguments). Overloading is resolved statically, depending only on the static types of the arguments. Multimethods occur when two or more methods have the same name, the same number of arg...
Overloading is when two or more methods have the same name but different signature (different argument types, different number of arguments). Overloading is resolved statically, depending only on the static types of the arguments. (The interaction of overloading and overriding, in Java, for example, makes the story a l...
|programming-languages|functional-programming|object-oriented|
|formal-languages|automata|context-free|pushdown-automata|
I'm reviewing for my midterm and wanted to post this to see if anyone can spot any errors. Im supposed to make a PDA that recognizes this CFG: $\qquad\begin{align} S &\to R1R1R1 \\ R &\to 0R \mid 1R \mid \varepsilon \end{align}$ Here is my solution; I'm aware that I forgot to draw the second circle around ...
|algorithm-analysis|asymptotics|recurrence-relation|
null
I'm going through the MIT Online Course Videos on Intro. to Algorithms at [here][1] at around 38:00. So we have a recursion formula $\qquad T(n) = T(n/10) + T(9n/10) + O(n)$ If we build a recursion tree it looks like T(n) -- Level 1 = c*n /...
Finding the number of leaves in a imbalanced recursion tree