instruction stringlengths 0 29.8k ⌀ |
|---|
This is a basic question, but I'm thinking that $O(m+n)$ is the same as $O(\max(m,n))$, since the larger term should dominate as we go to infinity? Also, that would be different from $O(\min(m,n))$. Is that right? |
|mathematical-analysis|landau-notation| |
You are right. Notice that the term $O(n+m)$ slightly abuses the classical [big-O Notation](https://en.wikipedia.org/wiki/Landau_symbols), which is defined for functions in **one** variable. However there is a [natural extension](http://people.cis.ksu.edu/~rhowell/asymptotic.pdf) for multiple variables.
Simply spea... |
This is a basic question, but I'm thinking that $O(m+n)$ is the same as $O(\max(m,n))$, since the larger term should dominate as we go to infinity? Also, that would be different from $O(\min(m,n))$. Is that right? I keep seeing this notation, esp. when discussing graph algorithms. For example, you routinely see: O(|V| ... |
null |
This is a basic question, but I'm thinking that $O(m+n)$ is the same as $O(\max(m,n))$, since the larger term should dominate as we go to infinity? Also, that would be different from $O(\min(m,n))$. Is that right? I keep seeing this notation, especially when discussing graph algorithms. For example, you routinely see: ... |
What is the meaning of $O(m+n)$? |
Believe it or not, it seems (in my experience) that many algorithms people have actually not thought about what the big O notation formally means, and when asked about it, you can get several different answers. Some issues are discussed in the paper [On Asymptotic Notation with Multiple Variables][1] by Rodney R. Howel... |
> I can not help but think: this is divide & conquer, plain and simple!
M/R is not divide & conquer. It does not involve the repeated application of an algorithm to a smaller subset of the previous input. It's a pipeline (a function specified as a composition of simpler functions) where pipeline stages are alternat... |
I am studying for an AI exam and I'm looking for a better way of solving the following problem:
> Graph shows a classification problem in the unit square [0,1]^2, where Class A
is denoted by the grey area in the figure (not including the points on the dotted lines),
and Class B occurs otherwise.
![Graph sho... |
Is there a simple way of calculating perceptron weights based on a classification graph? |
|artificial-intelligence|neural-networks| |
I'm seeking explanation on how one could prove that models of computation are equivalent. I have been reading books on the subject except that equivalence proves are omitted. I have a basic idea about what it means for two models of computation to be equivalent (the automata view: if they accept the same languages). Ar... |
Equivalence of models of computation |
|turing-machines|lambda-calculus|computation-models| |
I'm seeking explanation on how one could prove that two models of computation are equivalent. I have been reading books on the subject except that equivalence proofs are omitted. I have a basic idea about what it means for two models of computation to be equivalent (the automata view: if they accept the same languages)... |
How to show two models of computation are equivalent? |
I am studying for an AI exam and I'm looking for a better way of solving the following problem:
> Graph shows a classification problem in the unit square [0,1]^2, where Class A
is denoted by the grey area in the figure (not including the points on the dotted lines),
and Class B occurs otherwise.
![Graph shows a... |
As far as I know, the only (or at least most common) way to do this is to compare the languages the machines/models accept. That's the whole point of Automata theory: it takes the vague concept of a problem or algorithm and turns it into a concrete mathematical set (i.e. a language) which we can reason about.
The ea... |
|computability|turing-machines|lambda-calculus|computation-models|machine-models| |
I am looking for references and papers on the following topic.
1) general
Some programming languages allow dynamic changes to classes. As an example, a new instance variable ‘weight’ can be added to the class ‘Edge’ (the class of unweighted edges of graphs). But what should happen with existing edge objects?
T... |
Dynamic changes to classes or context activation -- how to treat existing objects in a consistent way? |
|reference-request|programming-languages|runtime-analysis|object-oriented| |
What you want to do is make some form of graph. Your nodes could be users on Twitter, or posts, actions, etc. I would recommend a weighted digraph with multiple edges allowed (though you could just represent this by summing the weights of multiple edges).
You want your edges to be something which indicates a link betw... |
|terminology|asymptotics|mathematical-analysis|landau-notation| |
I am studying for an AI exam and I'm looking for a better way of solving the following problem:
> Graph shows a classification problem in the unit square $[0,1]^2$, where Class A
is denoted by the grey area in the figure (not including the points on the dotted lines),
and Class B occurs otherwise.
![Graph shows... |
http://metamath.org/ has a large selection of proofs, build right up from their core in propositional logic.
That said, it is painfully lacking in terms of CS theory. Feel free to expand it! |
Rephrasing Kaveh's comment as an answer:
If you bound the size the values in the input (bound the number of bits for each value to be logarithmic in the total number of bits of the input) then the problem can be solve in polynomial time using dynamic programming. If they are not bounded they can have values which ar... |
The trick here is that this works well provided that your rules can be expressed in predicate form. Is golf still fun if it's raining, or if you play poorly?
If you need something more flexible, you might want to look at some statistical/Baysean tools. There, you'd say that golf had a high probability of being fun, ... |
*Below, assume we're working with an infinite-tape Turing machine.*
When explaining the notion of time complexity to someone, and why it is measured relative to the input size of an instance, I stumbled across the following claim:
> [..] For example, it's natural that you'd need more steps to multiply two integer... |
Why larger input sizes imply harder instances? |
|time-complexity|intuition| |
*Below, assume we're working with an infinite-tape Turing machine.*
When explaining the notion of time complexity to someone, and why it is measured relative to the input size of an instance, I stumbled across the following claim:
> [..] For example, it's natural that you'd need more steps to multiply two integer... |
You show that either model can *simulate* the other, that is given a machine in model A, show that there is a machine in model B that computes the same function. Note that this simulation does not have to be computable (but usually is).
Consider, for example, pushdown automata with two stacks (2-PDA). [In another qu... |
I am looking for references and papers on the following topic.
1. In *general*, some programming languages allow dynamic changes to classes. As an example, a new instance variable ‘weight’ can be added to the class `Edge` (the class of unweighted edges of graphs). But what should happen with existing edge objects... |
|reference-request|programming-languages|semantics|object-oriented| |
null |
*Below, assume we're working with an infinite-tape Turing machine.*
When explaining the notion of time complexity to someone, and why it is measured relative to the input size of an instance, I stumbled across the following claim:
> [..] For example, it's natural that you'd need more steps to multiply two integer... |
Just to ask, is there any existing algorithm to perform batch processing in the increase-key operation? Let us say, a binary heap is used. In the normal increase-key function, we perform increase on one node using the shiftup function. If we want to increase the key of 5 vertices in the heap, we need to call the increa... |
batch processing in increase-key function using binary heap |
|algorithms| |
|algorithms|data-structures|priority-queues| |
Just to ask, is there any existing algorithm to perform batch processing in the increase-key operation? Let us say, a binary heap is used. In the normal increase-key function, we perform increase on one node using the shiftup function. If we want to increase the key of 5 nodes in the heap, we need to call the increase-... |
A recent paper on this topic that I stumbled upon is
[Incremental Dynamic Updates
with First-class Contexts](http://scg.unibe.ch/archive/papers/Wern12a.pdf) by
Erwann Wernli, Mircea Lungu, and Oscar Nierstrasz. The approach taken in the paper is not based on global updates. Rather, multiple versions of a system run... |
> Is it the case that time complexity is always an increasing function
> in the input size? If so, why is it the case? Is there a proof for
> that beyond hand-waving?
Let $n$ denote the input size. To read the entire input, a turing machine already needs $n$ steps. So if you assume that an algorithm has to read i... |
> Is it the case that time complexity is always an increasing function
> in the input size? If so, why is it the case? Is there a proof for
> that beyond hand-waving?
Let $n$ denote the input size. To read the entire input, a turing machine already needs $n$ steps. So if you assume that an algorithm has to read i... |
Just to ask, is there any existing algorithm to perform batch processing in the increase-key operation? Let us say, a binary heap is used. In the normal increase-key function, we perform increase on one node using the shiftup function. If we want to increase the keys of 5 nodes in the heap, we need to call the increase... |
|complexity-theory|time-complexity|intuition| |
Just to ask, is there any existing algorithm to perform batch processing in the increase-key operation? Let us say, a binary heap is used. In the normal increase-key function, we perform increase key on one node by traversing paths toward the root . If we want to increase the keys of 5 nodes in the heap, we need to cal... |
> Is it the case that time complexity is always an increasing function
> in the input size? If so, why is it the case? Is there a proof for
> that beyond hand-waving?
Let $n$ denote the input size. To read the entire input, a turing machine already needs $n$ steps. So if you assume that an algorithm has to read i... |
> Is it the case that time complexity is always an increasing function
> in the input size? If so, why is it the case? Is there a proof for
> that beyond hand-waving?
Let $n$ denote the input size. To read the entire input, a turing machine already needs $n$ steps. So if you assume that an algorithm has to read i... |
null |
Just to ask, is there any existing algorithm to perform batch processing in the increase-key operation? Let us say, a binary heap (min-heap) is used. In the normal increase-key function, if we perform increase key on one node, then we have to traverse paths from the node towards the children to re balance the heap. If ... |
I am looking for answers which provide short overview of models and current state of research for [auto-parallelisation][1] of sequential code.
[1]: http://en.wikipedia.org/wiki/Automatic_parallelization |
What are current approaches to Auto-Parallelisation |
|compilers|concurrency|code-generation| |
null |
You show that either model can *simulate* the other, that is given a machine in model A, show that there is a machine in model B that computes the same function. Note that this simulation does not have to be computable (but usually is).
Consider, for example, pushdown automata with two stacks (2-PDA). [In another qu... |
[Metamath](http://metamath.org/) has a large selection of proofs, build right up from their core in propositional logic.
That said, it is painfully lacking in terms of CS theory. Feel free to expand it! |
The relation $(\mathbb{N},\leq)$ is [well-founded](https://en.wikipedia.org/wiki/Well-founded_relation), i.e. there are no infinite falling sequences in the natural numbers. Since runtime functions map to the naturals, all runtime functions *have* to be in $\Omega(1)$. |
|reference-request|compilers|parallel-computing|code-generation| |
What are current approaches to Auto-Parallelisation? |
|algorithms|data-structures|parallel-computing|concurrency|priority-queues| |
Is there an algorithm to perform batch processing in the increase-key operation? Let us say, a binary heap (min-heap) is used. In the normal increase-key function, if we perform increase key on one node, then we have to traverse paths from the node towards the children to re balance the heap. If we want to increase the... |
null |
This is just the Eulerian path problem on a multigraph. The colors are the vertices, and the dominos are the edges. You want to know whether there is a path that goes passes through each edge exactly once. It's polynomial time, and you should be able to find the algorithm by googling "Eulerian path". |
Lets say I have a bunch of cards or dominoes with one color on the left side of the
card and another color on the right. (The two colors could be the same)
dominoes can't be rotated so the color on each side is fixed. There is no
limit on the number of colors and colors can be repeated on cards.
Dominoes are plac... |
Complexity of domino tiling. (Dominoes placed in a line.) |
|complexity-theory| |
Let's say I have a bunch of cards or dominoes with one color on the left side of the
card and another color on the right. (The two colors could be the same.)
Dominoes can't be rotated so the color on each side is fixed. There is no
limit on the number of colors and colors can be repeated on cards.
Dominoes are pl... |
Complexity of domino tiling with dominoes placed in a line |
|complexity-theory| |
Batch processing in increase-key function using binary heap |
What are current approaches to auto-parallelisation? |
S --> Ta | b | Sc
T --> Tc | λ
This isn't an LL grammar but I need it to be so I can do a parse table. The problem is that no matter how much I try I never manage to do make it an LL grammar. Can someone please help by making it a LL grammar? It isn't that big and I'm very confused.
|
What's wrong with this LL grammar? (very short) |
|parsing|formal-languages| |
The relation $(\mathbb{N},\leq)$ is [well-founded](https://en.wikipedia.org/wiki/Well-founded_relation), i.e. there are no infinite falling sequences in the natural numbers. Since (worst-case) runtime functions map to the naturals, all runtime functions therefore *have* to be in $\Omega(1)$, that is all runtime functio... |
I have been taking a compiler course of Stanford on coursera. I have a slight misunderstanding on the parsing table of the following grammar:
S -> Sa | b
According to the professor parsing table looks like this:
* If the leftmost nonterminal is S and the input is 'a', the production is nothing.
* If t... |
LL(1) parsing table of left-recursive grammar |
|parsing| |
Keeping the parent of each vertex is not a requirement to get the minimum spanning tree. For example, the algorithm as described on Wikipedia does not do this: [Prim's Algorithm][1].
However, it's worth noting that there is more than one representation of an MST. In certain applications, it might be useful to quickl... |
There is an obvious similarity in workings between Prim's algorithm and Dijkstra's algorithm, however I see no reason for Prim's algorithm to keep track of a node's parent. In Dijkstra's algorithm, the parent of the node needs to be tracked in order to follow the chain back to the original node to determine the dista... |
Why does Prim's algorithm keep track of a node's parent? |
|untagged| |
Yes, it is always optimal.
No, there is no threshold where it would use less space to use fixed length non-encoded data.
I found a number of proofs on the Web, but there is sufficient discussion here: http://en.wikipedia.org/wiki/Huffman_coding
This also covers other techniques which achieve higher compression... |
Huffman coding approximates the population distribution with powers of two probability. If the true distribution does consist of powers of two probability (and the input symbols are completely uncorrelated), Huffman coding is optimal. If not, you can do better with range encoding. It is however optimal among all encodi... |
The entropy `H(A)` for this problem is `1.998`. Both Huffman coding and fixed length coding for this problem has avg codeword length as `2`. And FYI the coding you have got using Huffman Encoding is wrong. Huffman Encoding also produces codes similar to fixed length for this problem. It uses greedy approach. So `a` doe... |
The requirement of the encoding to be *prefix free* results in large trees due to the tree having to be complete. Is there a threshold where fixed-length non-encoded storage of data would be more efficient than encoding the data? |
Is Huffman Encoding always optimal? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.