instruction stringlengths 0 29.8k ⌀ |
|---|
What is a good reference to learn State transition systems? |
|computability|automata|rewriting-systems| |
I'm doing some exam (java based algorithmics) revision and have been given the question:
"Describe how you might extend your implementation [of a queue using a circular array] to support the expansion of the Queue to allow it to store more data items"
I've got two current answers to this, but I'm not sure either ... |
Extending the implementation of a Queue using a circular array |
|algorithms| |
I'm doing some exam (java based algorithmics) revision and have been given the question:
"Describe how you might extend your implementation [of a queue using a circular array] to support the expansion of the Queue to allow it to store more data items"
I've got two current answers to this, but I'm not sure either ... |
One very nice, delightful even, book that introduces state transition systems, also known as labelled transition systems, in the context of concurrent formalisms CCS and the $\pi$-calculus is
_Communicating and Mobile Systems: the Pi-Calculus_ by Robin Milner. Definitely worth reading.
 (DFA)
* [nondeterministic finite automaton](https://en.wikipedia.org/wiki/Finite_automaton) (NFA)
* [regular expression](https://en.wikipedia.org/wiki/Regular_expre... |
So I know that $\log^*$ means iterated logarithm, so $\log^*(3)$ = $(\log\log\log\log...)$ until $n \leq 1$.
I'm trying to solve the following:
is
> $\log^*(2^{2^n})$
little $o$, little $\omega$, or $\Theta$ of
> ${\log^*(n)}^2$
In terms of the interior functions, $\log^*(2^{2^n})$ is much big... |
$\log^*(n)$ runtime analysis |
null |
Notice that, by applying the definition twice, we get $\log^*(2^{2^n}) = \log^*n + 2$. Now compare $\log^*n + 2$ and $(\log^*n)^2$. |
I didn't really understand your problem description, but if you go by the timezone analogy, the only thing stopping you from using Djikstra's algorithm are the negative costs on some edges (ie.: some edges go back in time). If this is the problem, you can get around it by using an alternate algorithm that can handle ne... |
Let's write it out and see what we get. To track the number of logs, I'll subscript them; I know that's usually base, if anyone has a better idea let me know or edit it in:
$$
\log^*(2^{2^n}) \\
= \log_1(\log_2(...\log_k(2^{2^n})...)) \\
= \log_1...\log_{k-1}(2^n\log_{k}(2)) \\
= \log_1...\log_{k-2}(\log_{k-1}(2... |
Recall that for $k > 1$, by definition we have $\log^*k = \log^*(\log{k}) + 1$.
By applying the definition twice, we see that $\log^*(2^{2^n}) = \log^*n + 2$. Now we can compare $\log^*n + 2$ and $(\log^*n)^2$. |
Suppose your array has $n$ elements. As you have noted, the median is always in the bigger part after the first partition. The bigger part has size at most $\alpha n$ if the smaller part has size at least $(1-\alpha) n$. This happens when you pick a pivot that isn't one of the smallest or largest $(1-\alpha) n$ elem... |
Let's write it out and see what we get. To track the number of logs, I'll subscript them; I know that's usually base, if anyone has a better idea let me know or edit it in:
$$
\log^*(2^{2^n}) \\
= \log_1(\log_2(...\log_k(2^{2^n})...)) \\
= \log_1...\log_{k-1}(2^n\log_{k}(2)) \\
= \log_1...\log_{k-2}(\log_{k-1}(2... |
|algorithm-analysis|randomized-algorithms| |
null |
*<sup>This answers the question after the number of repeat-free words per size, implying that the desired quantity even exists.</sup>*
**Definition:** Call $w \in \Sigma$ *repeat-free* if and only if it does not contain a factor $xyx$ with $x \in \Sigma^{\geq 2}$ and $y \in \Sigma^*$.
**Claim:** For given finite ... |
> Let .5<α<1 be some constant. Suppose you are looking for the median
> element in an array using RANDOMIZED SELECT (as explained in
> lectures). What is the probability that after the first iteration the
> size of the subarray in which the element you are looking for lies is
> ≤α times the size of the original arr... |
I am studying different approaches for the definition of computation with continuous dynamical systems. I have been trying to find a nice introduction to the theory of ["State transition systems"](http://en.wikipedia.org/wiki/State_transition_system) but failed to do so.
Does anybody know a modern introduction to th... |
What is a good reference to learn about state transition systems? |
|computability|automata|reference-request|computation-models| |
> Let $.5<\alpha <1$ some constant. Suppose you are looking for the median
> element in an array $A$ using randomised selection (as explained in
> lectures). What is the probability that after the first iteration the
> size of the subarray in which the element you are looking for lies in is
> at most $\alpha$ times... |
|algorithm-analysis|probability-theory|randomized-algorithms| |
|asymptotics|landau-notation|mathematical-analysis| |
|algorithms|algorithm-analysis|probability-theory|randomized-algorithms| |
The randomized selection algorithm is the following:
Input: An array $A$ of $n$ (distinct, for simplicity) numbers and a number $k\in [n]$
Output: The the "rank $k$ element" of $A$ (i.e., the one in position $k$ if $A$ was sorted)
Method:
* If there is one element in $A$, return it
* Select an element $p$ ... |
null |
The usual simple algorithm for finding the median element in an array $A$ of $n$ numbers is:
* Sample $n^{3/4}$ elements from $A$ with replacement into $B$
* Sort $B$ and find the rank $|B|\pm \sqrt{n}$ elements $l$ and $r$ of $B$
* Check that $l$ and $r$ are on opposite sides of the median of $A$ and that there a... |
Sharp concentration for selection via random partitioning? |
|randomized-algorithms| |
The usual simple algorithm for finding the median element in an array $A$ of $n$ numbers is:
* Sample $n^{3/4}$ elements from $A$ with replacement into $B$
* Sort $B$ and find the rank $|B|\pm \sqrt{n}$ elements $l$ and $r$ of $B$
* Check that $l$ and $r$ are on opposite sides of the median of $A$ and that there a... |
|algorithm-analysis|randomized-algorithms| |
The usual simple algorithm for finding the median element in an array $A$ of $n$ numbers is:
* Sample $n^{3/4}$ elements from $A$ with replacement into $B$
* Sort $B$ and find the rank $|B|\pm \sqrt{n}$ elements $l$ and $r$ of $B$
* Check that $l$ and $r$ are on opposite sides of the median of $A$ and that there a... |
I'm doing some exam (Java-based algorithmics) revision and have been given the question:
> Describe how you might extend your implementation [of a queue using a circular array] to support the expansion of the Queue to allow it to store more data items.
The Queue started off implemented as an array with a fixed ma... |
This question is motivated by my [answer][1] to another question in which I stated the fact the both Betweness and Non-Betweeness problems are $NP$-complete. In the former problem there a total order such that the betweeness constraint of the triples is enforced while in the later problem there total order such that t... |
Complexity of 3SAT variants |
|complexity-theory| |
This question is motivated by my [answer][1] to another question in which I stated the fact that both Betweness and Non-Betweeness problems are $NP$-complete. In the former problem there is a total order such that the betweeness constraint of each triple is enforced while in the later problem there is a total order suc... |
This question is motivated by my [answer][1] to another question in which I stated the fact that both Betweeness and Non-Betweeness problems are $NP$-complete. In the former problem there is a total order such that the betweeness constraint of each triple is enforced while in the later problem there is a total order su... |
null |
3SAT_1 is easy, and a variant of 3SAT_2 is NP-complete. My guess is that 3SAT_2 is also NP-complete.
Let $C = x\lor y\lor z$ be a clause. Then $\lnot C = \lnot x \land \lnot y \land \lnot z$. An assignment makes every clause of $\phi$ false if it makes all their negations true. The conjunction of the negation of all... |
Hash table lookup can always be $O(1)$, see the 2002 paper by Arne Andersson and Mikkel Thorup: [Dynamic ordered sets with exponential search trees][1]
> Firstly, we give the first deterministic polynomial-time (in n)
> algorithm for constructing a linear space static dictionary with $O(1)$
> worst-case access cost... |
null |
It's not true that the algorithm runs in linear time with high probability. Considering only the first round, the running time is at least $\Theta(n)$ times a $G(1/2)$ random variable. Let $p(n) \longrightarrow 0$ be the allowed failure probability. Since $\Pr[G(1/2) \geq \log_2 p(n)^{-1}] = p(n)$, the running time is ... |
|complexity-theory|satisfiability| |
|algorithms|satisfiability|3-sat| |
|algorithms|algorithm-analysis|randomized-algorithms| |
3SAT_1 is easy, and a variant of 3SAT_2 is NP-complete. My guess is that 3SAT_2 is also NP-complete. Update: my guess is proved below.
Let $C = x\lor y\lor z$ be a clause. Then $\lnot C = \lnot x \land \lnot y \land \lnot z$. An assignment makes every clause of $\phi$ false if it makes all their negations true. The ... |
I am not a data structures expert, but the usual theoretical approach to hashing is that one defines a *family* of functions (e.g., $h_{a,b}(x) = ax + b \mod p$) and then considers the behavior on a *worst case* input where the adversary doesn't know the random choice in advance. This is similar to how randomized algo... |
I am looking for algorithms to optimize a strictly monotonic function $f$ such that $f(x) < y$
> $f : [a,b] \longrightarrow [c,d]$
>
> $argmax{_x} f(x) < y$
>
> $ [a,b] \subset {\mathbb N} $
>
> $ [c,d] \subset {\mathbb N}$
My first idea was to use a variant of bianry search, pick a point x in [a,b] at ... |
Optimizing a strictly monotone function |
|algorithms|optimization| |
i have written a program about sorting of Linked Lists and i noticed that the InsertionSort works much better than the QuickSort algorithm.
Someone has an idea why it is so?
Insertionsort has a complexity of O(n^2) and Quicksort O(nlogn) so therefore Quicksort should be faster.... i tried for random input size and i... |
Quicksort vs. InsertionSort on LinkedList - Performance |
|algorithms|algorithm-analysis| |
i have written a program about sorting of Linked Lists and i noticed that the InsertionSort works much better than the QuickSort algorithm.
Someone has an idea why it is so?
Insertionsort has a complexity of O(n^2) and Quicksort O(nlogn) so therefore Quicksort should be faster.... i tried for random input size and i... |
The problem is that the analysis of Quicksort assumes that accessing any element can be done at a constant cost, i.e. in $\mathcal O(1)$. This is not the case with linked lists.
Note that at the top of the `while (right > left) {` loop in your code, you cycle through all the elements until `left` and then repeatedly... |
i have written a program about sorting of Linked Lists and i noticed that the InsertionSort works much better than the QuickSort algorithm.
Someone has an idea why it is so?
Insertionsort has a complexity of O(n^2) and Quicksort O(nlogn) so therefore Quicksort should be faster.... i tried for random input size and i... |
The problem is that the analysis of Quicksort, as you have implemented it, assumes that accessing any element can be done at a constant cost, i.e. in $\mathcal O(1)$. This is not the case with linked lists.
Note that at the top of the `while (right > left) {` loop in your code, you cycle through all the elements unt... |
I am looking for algorithms to optimize a strictly monotonic function $f$ such that $f(x) < y$
> $f : [a,b] \longrightarrow [c,d]$
>
> $argmax{_x} f(x) < y$
>
> $ [a,b] \subset {\mathbb N} $
>
> $ [c,d] \subset {\mathbb N}$
My first idea was to use a variant of binary search, pick a point x in [a,b] at ... |
I have written a program to sort Linked Lists and I noticed that my insertion sort works much better than my quicksort algorithm.
Does anyone have any idea why this is?
Insertion sort has a complexity of $O(n^2)$ and quicksort $O(n\log n)$ so therefore quicksort should be faster. I tried for random input size and it... |
null |
I have written a program to sort Linked Lists and I noticed that my insertion sort works much better than my quicksort algorithm.
Does anyone have any idea why this is?
Insertion sort has a complexity of $\Theta(n^2)$ and quicksort $O(n\log n)$ so therefore quicksort should be faster. I tried for random input size a... |
|algorithms|algorithm-analysis|algorithm-engineering| |
Using the `Vector` class is certainly a possibility, as a practical matter. Other solutions will amount to implementing functionality that is similar to what the `Vector` class provides (possibly in a way that is more efficient given that the data structure stores a queue).
Some languages offer inherently resizable ... |
It's not true that the algorithm runs in linear time with high probability. Considering only the first round, the running time is at least $\Theta(n)$ times a $G(1/2)$ random variable. Let $p(n) \longrightarrow 0$ be the allowed failure probability. Since $\Pr[G(1/2) \geq \log_2 p(n)^{-1}] = p(n)$, the running time is ... |
There are various single instructions that lead to Turing complete languages. The typical example is "subtract and branch if zero". These are well known in the context of assembly language programming. See [the Wikipedia article][1] for details.
This leads to a characterization: a language is Turing complete if and... |
Using the `Vector` class is certainly a possibility, as a practical matter. Other solutions will amount to implementing functionality that is similar to what the `Vector` class provides (possibly in a way that is more efficient given that the data structure stores a queue).
Some languages offer inherently resizable ... |
The combinators $\mathbf{S}$ and $\mathbf{K}$ where, $(\mathbf{S}\ x\ y\ z) = (x\ z\ (y\ z))$ and $(\mathbf{K}\ x\ y) = x$ are sufficient to express any (closed) lambda term, therefore any computable function. See this [wikipedia page][1] for details.
In fact, the lambda term $\mathbf{X}=\lambda x.((x\ \mathbf{S}... |
The usual simple algorithm for finding the median element in an array $A$ of $n$ numbers is:
* Sample $n^{3/4}$ elements from $A$ with replacement into $B$
* Sort $B$ and find the rank $|B|\pm \sqrt{n}$ elements $l$ and $r$ of $B$
* Check that $l$ and $r$ are on opposite sides of the median of $A$ and that there a... |
The usual simple algorithm for finding the median element in an array $A$ of $n$ numbers is:
* Sample $n^{3/4}$ elements from $A$ with replacement into $B$
* Sort $B$ and find the rank $|B|\pm \sqrt{n}$ elements $l$ and $r$ of $B$
* Check that $l$ and $r$ are on opposite sides of the median of $A$ and that there a... |
Use this tag if you ask for pointers to material for self-study. |
Hash table lookup can always be $O(1)$ for static sets, see the 2002 paper by Arne Andersson and Mikkel Thorup: [Dynamic ordered sets with exponential search trees][1]
> Firstly, we give the first deterministic polynomial-time (in n)
> algorithm for constructing a linear space static dictionary with $O(1)$
> worst-... |
I am not a data structures expert, but the usual theoretical approach to hashing is that one defines a *family* of functions (e.g., $h_{a,b}(x) = ax + b \mod p$) and then considers the behavior on a *worst case* input where the adversary doesn't know the random choice in advance. This is similar to how randomized algo... |
The title is very nice, you don't say not.
The last year, i was reading a paper abut "Quantum Mechanics for KinderGarden", a fantastic paper http://arxiv.org/abs/quant-ph/0510032, but these was not easy paper.
My actually problem is about HOW do i explain the quicksort in the more simple words. And, How can i prov... |
Quicksort for Kids |
|programming-languages|algorithms| |
Quicksort's actually pretty easy to understand, if they understand basic counting and division by 2. Make a bunch of X flash cards, number them 1--X, and shuffle it. Then here's the explanation:
> OK, we've got this deck of (let's say 20) cards here. We want to put
> them in order, so 1 is first, then 2, then 3,... |
Last year, I was reading a fantastic [paper on “Quantum Mechanics for Kindergarden”](http://arxiv.org/abs/quant-ph/0510032). It was not easy paper.
Now, I wonder how to explain quicksort in the simplest words possible. How can I prove (or at least handwave) that the average complexity is $O(n \log n)$, and what the ... |
Quicksort explained to kids |
|algorithms|algorithm-analysis|didactics|sorting| |
|algorithms|education|algorithm-analysis|didactics|sorting| |
At its core, Quicksort is this:
1. Take the first item.
2. Move everything less than that first item to the left of it, everything greater to the right (assuming ascending order).
3. Recurse on each side.
I think every 4-year-old on the planet could do 1 and 2. The recursion might take a little bit more explan... |
At its core, Quicksort is this:
1. Take the first item.
2. Move everything less than that first item to the left of it, everything greater to the right (assuming ascending order).
3. Recurse on each side.
I think every 4-year-old on the planet could do 1 and 2. The recursion might take a little bit more explan... |
I am looking for algorithms to optimize a strictly monotonic function $f$ such that $f(x) < y$
$f : [a,b] \longrightarrow [c,d]
\qquad \text{where } [a,b] \subset {\mathbb N}, [c,d] \subset {\mathbb N}$
such that $\arg\max{_x} f(x) < y$
My first idea was to use a variant of binary search, pick a point $... |
I have written a program to sort Linked Lists and I noticed that my insertion sort works much better than my quicksort algorithm.
Does anyone have any idea why this is?
Insertion sort has a complexity of $\Theta(n^2)$ and quicksort $O(n\log n)$ so therefore quicksort should be faster. I tried for random input size a... |
|algorithms|algorithm-analysis|sorting|lists| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.