instruction stringlengths 0 29.8k ⌀ |
|---|
Rmin is the "**writing rate in application buffer**" (from router in your example).
This formula makes sense for different conditions like **Rapp=Rmin**. In this case the buffer size should be infinite (very large buffer) and it is intuitively correct. **Rapp>Rmin** makes the size negative which shows that bufferin... |
Let $\mathcal{L}$ be a language and $M_1$ be a machine that recognizes this language. Suppose that the time (resp. space) complexity of $M_1$ is $f(n)$ for some $f$.
Is it computable to tell, given $\mathcal{L}$ and $M_1$, does there exist a machine $M_2$ such that the time (resp. space) complexity of $M_2$ is $o(f... |
Existence of an algorithm to tell if for a given language L with a machine $M_1$, there exists a more efficient machine $M_2$ to L? |
null |
null |
An assignment question asks me to find the complexity of a [tail] recursive algorithm, copied below. While I understand all the complexity specifics, for example that the while loop's complexity is $n-1$ and the complexity of setting $j$ to $0$ is 1, I don't understand how I could trace the code recursively, that is... |
Finding the complexity of a recursive method |
|algorithms|complexity-theory|time-complexity|algorithm-analysis| |
The importance of Turing machines is twofold. First, Turing machines were one of the first (if not *the* first) theoretical models for computers, dating from 1936. Second, a lot of theoretical computer science has been developed with Turing machines in mind, and so a lot of the basic results are in the language of Turi... |
Ha! Were the answer yes, we would be living in a different world.
Imagine that the answer to your question was yes (and of course we knew the algorithm $A_0$ that would answer your question), then for any algorithm $A$ for language $L$, we would be able to tell (using $A_0$) if $A$ is optimal or not.
Unfortunate... |
It is easier to catch the connection with sorting if you first sort the points by their **polar angle**. This is the basic idea for the [Graham scan][1]. Though, the idea with sorting points by the x-coordinates also works: you need then to apply just a slight modification of the same Graham's algorithm).
[1]: h... |
¿What is the definition of the decision version of independent set? and why $k$-independent set is not in P?
I always read that fining an independent set of size $k$ in a graph is NP-complete. However, this only requires looking for all combinations of $k$ vertices and this is a polynomial procedure of order $k$.
... |
¿What is the definition of the decision version of independent set? and why k-independent set is not in P? |
|complexity-theory| |
The problem is $k$ might be very big, say as big as about $n$. Then $n^k$ would be exponentially large. |
The definition of the decision version of independent set is the following:
Given as input a graph $G = (V,E)$ and an integer $k \in \mathbb{N}$, does there exist a set of pairwise non-adjacent vertices $I \subseteq V$ of size $|I| \geq k$?
The problem is polynomial time solvable if you consider $k$ to be _consta... |
Suppose a process keeps running code (e.g. an infinite loop). How can other programs take over? What prevents the process from remaining active forever? |
What mechanisms prevent a process from taking over the processor forever? |
|operating-systems|process-scheduling| |
The definition of the decision version of independent set is the following:
Given as input a graph $G = (V,E)$ and an integer $k \in \mathbb{N}$, does there exist a set of pairwise non-adjacent vertices $I \subseteq V$ of size $|I| \geq k$?
The problem is polynomial time solvable if you consider $k$ to be _consta... |
You have to analyze the circumstances in which your algorithm makes a recursive call. That is, when is `not done` true? Well, your it's true whenever your algorithm is required to make a swap in one of its passes over the array (one of the while loops). To analyze the total worst case running time, determine the maxim... |
As others mentioned the answer is no.
But there is an interesting article written by [Blum][1] "[A Machine-Independent theory of the Complexity of Recursive Functions][2]". He showed that **there are some functions with the property that no matter how fast a program may be for computing these functions another pr... |
The value a pixel gets after applying the median filter only depends on points in the $3\times 3$ window centered at it. So applying the media filter twice, any pixel depends only on points in the $5\times 5$ window centered at it. So you could in principle do it in one go, using a larger window and a more complicated ... |
null |
There is a paper "[Using Mobile Phones to Write in Air][1]". It basically uses the mobile sensors and machine learning to detect words. The Results show that English characters can be identified with an average accuracy of 91:9%.
There are some open source projects like "[hand-gesture-detection][2]" on Google code. I... |
null |
Various peripherals are connected to the main processor. When an event happens in a peripheral, the peripheral sets an electric signal which causes the processor to take some action. The act of setting this signal is called an [interrupt request](http://en.wikipedia.org/wiki/Interrupt_request) (IRQ for short), and the ... |
null |
I always read that fining an independent set of size $k$ in a graph is $\mathsf{NP}$-complete. However, this only requires looking for all combinations of $k$ vertices and this is a polynomial procedure of order $k$.
I know that we can reduce directly SAT to independent set, with $k$ = number of clauses.
The prob... |
What is the decision version of independent set? And why isn't $k$-independent in $\mathsf P$? |
Decision tree classifiers could be easily converted to rule based classifiers in data mining and vice Versa. please have a look at "[Introduction to Data Mining][1]", chapters 4 and 5.
Usually it depends on the data characteristics, how to choose between these two methods and which of the mentioned methods give you ... |
Theoretically, if I were to subtract the number 10 from the ASCII character 10 (which is really 00110001 00110000), what would I get?
Does the computer add both ASCII characters and subtract? |
Subtracting an integer from an ASCII number |
|binary-arithmetic| |
It depends how exactly you do the subtraction. Depending on the processor, the string 10 is either 0x3031 (little endian) or 0x3130 (big endian). Most modern processors are little endian. That's assuming you regard 10 as a 16-bit integer, i.e. a C short on modern computers. If you're regarding it as a C char, then only... |
null |
I am interested in precise time complexity of distributed algorithm for finding MIS (Maximum Independent Set) of a given graph $G$.
Slow MIS distributed algorithm - [Maximal Independent Set](http://disco.ethz.ch/lectures/podc_allstars/lecture/chapter7.pdf).
The idea of the algorithm is very simple: if all neighbo... |
Slow MIS Distributed Algorithm |
|algorithms|time-complexity|distributed-systems| |
I am learning C++ and noticed that the running time for the push_back function for vectors is constant "amortized." The documentation further notes that "If a reallocation happens, the reallocation is itself up to linear in the entire size."
Shouldn't this mean the push_back function is $O(n)$, where $n$ is the leng... |
Why is push_back in C++ vectors constant amortized? |
|amortized-analysis| |
You should distinguish the following two things.
**Independent Set** (what Pål GD described in his answer)
Instance: A graph <i>G</i> and an integer <i>k</i>∈ℕ.
Question: Does <i>G</i> have an independent set of size <i>k</i>?
**<i>k</i>-Independent Set** (<i>k</i>∈ℕ)
Instance: A graph <i>G</i>.
Quest... |
null |
The important word here is "amortized". Amortized analysis is an analysis technique that examines a sequence of $n$ operations. If the whole sequence runs in $T(n)$ time, then each operation in the sequence runs in $T(n)/n$. The idea is that while a few operations in the sequence might be costly, they can't happen ofte... |
The important word here is "amortized". Amortized analysis is an analysis technique that examines a sequence of $n$ operations. If the whole sequence runs in $T(n)$ time, then each operation in the sequence runs in $T(n)/n$. The idea is that while a few operations in the sequence might be costly, they can't happen ofte... |
The important word here is "amortized". Amortized analysis is an analysis technique that examines a sequence of $n$ operations. If the whole sequence runs in $T(n)$ time, then each operation in the sequence runs in $T(n)/n$. The idea is that while a few operations in the sequence might be costly, they can't happen ofte... |
**Hint 1**: This algorithm is similar to [bubble sort][1]. It sorts the array in ascending order.
**Hint 2**: Try to work out what the series of swaps do when taken to completion. For example, what happens when the two `while` loops are run on the following array: $\{4, 2, 5, 6, 1, 3\}$. After the first while loop, ... |
|efficiency|binary-arithmetic| |
|algorithms|algorithm-analysis|runtime-analysis| |
null |
I don't know the right name for this problem, or if there is a name, but it is inspired by my initial interpretation of the title of [this][1] question. Anyways, the question is this:
We are initially given a list of "items" to be filled in a knapsack of fixed size. Each item has a weight (bounded, integral) and val... |
Dynamic Knapsack Problem - Algorithms and References |
|algorithms|reference-request|optimization|combinatorics|knapsack-problems| |
The simplest way to sort lists is mergesort: Split the list into halves (just zip down, one element left, one right), sort left and right recursively, then merge (take the smaller of the first elements of the left and right lists). Well suited to lists (just linear transversals, mostly pointer juggling), and $\Theta(n ... |
This part of computer science is called analysis of algorithms. Many times people are satisfied when they are given a guarantee that an algorithm’s performance is not worse than a specified bound and they dont’t care about the exact performance.
This bound is conveniently denoted with the [Landau-notation][1] (or bi... |
null |
null |
I think I nailed the problem down. In essence: using Landau terms decouples the variable of the summand function from the sum's running variable. We still (want to) read them as identical, though, therefore the confusion.
To develop it formally, what does
$\qquad \displaystyle S_n \in \sum_{i=1}^n \Theta(f(i)) \... |
I just started reading about TOC. If we compare which is more powerful (in accepting strings), both are same. But what about efficiency ? DFA will be fast compared to NFA, since it has only one outgoing edge & there will be no ambiguity. But in case of NFA we have to check all possible cases & that surely takes time. S... |
Can we say DFA is more efficient than NFA? |
|nondeterminism| |
I'm reading Cormen's Introduction to Algorithms 3-rd edition, and in examples of Master Method recursion solving Cormen gives two examples
1. 3T( n / 4 ) + n * lgn
2. 2T( n / 2 ) + n * lgn
For the first example we have a==3 and b==4 so (n ^ log_4 3) == 0.793 and Cormen says that if we choose eps = 0.207 then f(... |
Master Method Cormen 3T( n / 4 ) + n * lgn && 2T( n / 2 ) + n * lgn |
|algorithms| |
I just started reading about TOC. If we compare which is more powerful (in accepting strings), both are same. But what about efficiency ? DFA will be fast compared to NFA, since it has only one outgoing edge & there will be no ambiguity. But in case of NFA we have to check all possible cases & that surely takes time. S... |
|finite-automata|nondeterminism| |
In terms of power, they are equivalent as you said and there is an algorithm (subset construction) for converting an NFA to an equivalent DFA. As you might tell from the algorithm's name, it constructs subsets of states of the NFA. If your NFA has n states, the algorithm may output a DFA with $2^n$ states but that's an... |
I'm reading Cormen's Introduction to Algorithms 3-rd edition, and in examples of Master Method recursion solving Cormen gives two examples
1. $3T( \frac{n}{4} ) + n\log(n)$
2. $2T( \frac{n}{2} ) + n\log(n)$
For the first example we have $a=3$ and $b=4$ so $n^{\log_4
(3)}=n^{0.793}$ and Cormen says that if we c... |
null |
In terms of power, they are equivalent as you said and there is an algorithm (subset construction) for converting an NFA to an equivalent DFA. As you might tell from the algorithm's name, it constructs subsets of states of the NFA. If your NFA has n states, the algorithm may output a DFA with $2^n$ states but that's an... |
There are two answers, depending on how you define efficient.
Compactness of representation
-
*Telling more with less*: NFAs are more efficient.
Converting a DFA to an NFA is straightforward and does not increase the size of the representation.
However, there are regular languages for which the smallest DF... |
I'm reading Cormen's Introduction to Algorithms 3rd edition, and in examples of Master Method recursion solving Cormen gives two examples
1. $3T( \frac{n}{4} ) + n\log(n)$
2. $2T( \frac{n}{2} ) + n\log(n)$
For the first example we have $a=3$ and $b=4$ so $n^{\log_4
(3)}=n^{0.793}$ and Cormen says that if we ch... |
Master Method Cormen $3T( n / 4 ) + n \log n$ and $2T( n / 2 ) + n \log n$ |
If you use the *purely theoretical* "number of steps to accept/reject" measure, a DFA will always be cheaper than an NFA that uses $\epsilon$-transitions. For more complex automata such a measure will make a difference. |
In terms of power, they are equivalent as you said and there is an algorithm (subset construction) for converting an NFA to an equivalent DFA. As you might tell from the algorithm's name, it constructs subsets of states of the NFA. If your NFA has $n$ states, the algorithm may output a DFA with $2^n$ states but that's ... |
Although @Marc has given (what I think is) an excellent analysis, some people might prefer to consider things from a slightly different angle.
One is to consider a slightly different way of doing a reallocation. Instead of copying all the elements from the old storage to the new storage immediately, consider copying... |
Speaking in terms of automata and regular languages, how would it be possible for a string of 2 to equal a string of 3?
{w ɛ Σ* : ww = www}
The only thing I can think of is w = abab, ww = abababab, www = abababababab, but I don't think this is correct. |
Theoretical CompSci & automata |
|formal-languages|automata| |
I'm reading Cormen's Introduction to Algorithms 3rd edition, and in examples of Master Method recursion solving Cormen gives two examples
1. $3T( \frac{n}{4} ) + n\log(n)$
2. $2T( \frac{n}{2} ) + n\log(n)$
For the first example we have $a=3$ and $b=4$ so $n^{\log_4
(3)}=n^{0.793}$ and Cormen says that if we ch... |
null |
A string of length $2$ cannot be equal to a string of length $3$. But a string constructed by concatenation of $2$ strings may be equal to a string constructed by concatenating $3$ strings. The empty string (denoted by $\epsilon$) is of length = $0$ and it's a member in $\Sigma^*$. If $w$ is chosen to be the empty stri... |
A string of length $2$ cannot be equal to a string of length $3$. But a string constructed by concatenation of $2$ strings may be equal to a string constructed by concatenating $3$ strings. The empty string (denoted by $\epsilon$) is of length = $0$ and it's a member in $\Sigma^*$. If $w$ is chosen to be the empty stri... |
Here is a simple argument to show that it is undecidable. We reduce the halting problem on blank tape to this problem.
Let $M$ be a given Turing machine. Let N be the following Turing machine:
$N$: on input $n$
1. Run $M$ on blank tape for (at most) $n$ steps.
2. If $M$ does not halts, run a loop of size $n^2... |
Is it possible to decide if a given algorithm is asymptotically optimal? |
|complexity-theory|computability|undecidability|decision-problem| |
Is there an algorithm for the following problem:
> Given a Turing machine $M$,
> Is there a Turing machine $N$ computing the same function as $M$ such that
> $t_N(n) = o(t_M(n))$?
The functions $t_M$ and $t_N$ are the worst-case running times of Turing machines $M$ and $N$ respectively.
What about space co... |
Here is a simple argument to show that they are undecidable, i.e. there are no algorithms to check if a given algorithm is optimal regarding its running-time or memory usage.
We reduce the halting problem on blank tape to your problem about running-time optimality.
Let $M$ be a given Turing machine. Let N be the... |
I'm reading Cormen's Introduction to Algorithms 3rd edition, and in examples of Master Method recursion solving Cormen gives two examples
1. $3T( \frac{n}{4} ) + n\log(n)$
2. $2T( \frac{n}{2} ) + n\log(n)$
For the first example we have $a=3$ and $b=4$ so $n^{\log_4
(3)}=n^{0.793}$ and Cormen says that if we ch... |
Here is a simple argument to show that they are undecidable, i.e. there are no algorithms to check if a given algorithm is optimal regarding its running-time or memory usage.
We reduce the halting problem on blank tape to your problem about running-time optimality.
Let $M$ be a given Turing machine. Let N be the... |
I copied this answer from [computational science][1]
There is a theorem that syas that a black box algorithm is guaranteed to find the global minimum of an arbitrary smooth (i.e., twice continuously differentiable) function if and only if it samples points densely in the search space.
Here dense is meant in th... |
Here is a simple argument to show that they are undecidable, i.e. there are no algorithms to check if a given algorithm is optimal regarding its running-time or memory usage.
We reduce the halting problem on blank tape to your problem about running-time optimality.
Let $M$ be a given Turing machine. Let N be the... |
The only way that $w w = w w w$ is that $w = \epsilon$. Algebra of strings (for mathematician types, the free monoid on $\Sigma$) isn't _that_ different from multiplication... |
If you subtract the _integer_ 10 from the _ASCII character (code)_ for 'a' (which is decimal 61) you get the ASCII code for 'Q'.
If you are asking because of mysteriously looking expressions like `c - 'a'` (or `c - '0'`) (some C hacks are fond of those), they give the letter position of `c` (respectively the value o... |
I think you used that method wrong! As mention in [master theorem][1] case 3. In your case you should use case 3 which use **big omega** notation which describes **asymptotic lower bound**.
So the solution in the book is correct!
you used **big O notion** which is **asymptotic upper bound!**. Be careful about which... |
I think you used that method wrong! As mention in [master theorem][1] case 3. In your case you should use case 3 which use **Big Omega** notation which describes **Asymptotic Lower Bound**.
So the solution in the book is correct!
you used **Big O notion** which is **Asymptotic Upper Bound!**. Be careful about whic... |
I'm reading Cormen's Introduction to Algorithms 3rd edition, and in examples of Master Method recursion solving Cormen gives two examples
1. $3T( \frac{n}{4} ) + n\log(n)$
2. $2T( \frac{n}{2} ) + n\log(n)$
For the first example we have $a=3$ and $b=4$ so $n^{\log_4
(3)}=n^{0.793}$ and Cormen says that if we ch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.