instruction
stringlengths
0
29.8k
⌀
Size of the universe for van Emde Boas Trees
|algorithms|data-structures|binary-trees|trees|
This assumption makes the analysis easier. If the universe $\mathcal{U}$ is of size $2^{2^k}$ then every element in $\mathcal{U}$ can be represented by $2^k$ bits. Roughly speaking, when executing one of the vEB-tree operations you halve the "relevant bits" in every level of the recursion. So when you start with $2^k$ ...
In order to achieve the time complexity of $O(\log \log u)$ for van Emde Boas trees I read in [this lecture][1] that the the universe size $u$ is chosen as $u = 2^{2^k}$ for some integer $k$ for van Emde Boas trees. Why choose $u$ to be of this specific form ? [1]:http://fileadmin.cs.lth.se/cs/Personal/Rolf_Karlss...
|algorithms|data-structures|algorithm-analysis|binary-trees|trees|
In my variant of the assignment problem I have a set $A$ of agents and a set (of possibly different cardinality) $T$ of tasks. Each agent needs to be assigned exactly $n$ or $n+1$ tasks, and each task needs to be assigned to exactly $m$ or $m+1$ agents. It is guaranteed this this is possible: the segment $\left[ |A|...
I was studying operating system concepts from [Silberschatz, Galvin and Gagne's book](http://www.amazon.com/Operating-System-Concepts-Abraham-Silberschatz/dp/0471417432) (sixth edition) and I have some questions about the flow of execution of a program. A figure explains the processing of the user program: ![program...
Program compilation and execution flow
|compilers|operating-systems|memory-management|virtual-memory|
The dynamic programming solution computes a table that for each $i\le j$ has the optimal solution for $Ai$, ... $Aj$. The computation is done bottom-up, and (as one of the comments notes) many values are reused. Total complexity order $n^3$ as there is a quadratic number of $i,j$ each taking linear time to compute. ...
|algorithms|data-structures|algorithm-analysis|search-trees|trees|
From [Van Emde Boas trees lecture][1]: > We will use the idea of superimposing a tree of degree ${u^{1/2}}$ on top of > a bit vector, but **shrink the universe size recursively** by a square > root at each tree level. The ${u^{1/2}}$ items on the first level each hold > structures of ${u^{1/4}}$ items, which hold...
From [Van Emde Boas trees lecture][1]: > We will use the idea of superimposing a tree of degree ${u^{1/2}}$ on top of > a bit vector, but **shrink the universe size recursively** by a square > root at each tree level. The ${u^{1/2}}$ items on the first level each hold > structures of ${u^{1/4}}$ items, which hold...
Explanation of recursive structure of Van Emde Boas Tree
Well the crucial idea about vEB trees is the following: You store all the elements as a 0/1 bitvector of size $s$. For example the vector $(0,1,1,0)$ denotes that in your universe of size $s=4$, the third and second elements are present. Now you subdivide the vectors in blocks of size $\sqrt{s}$ and for every block you...
null
There is a very simple undecidable problem for finite state automata. Break the alphabet into two halves $\Sigma \cup \bar\Sigma$, where the letters in $\bar\Sigma$ are "barred" copies. Now, given a finite state automaton $A$ over $\Sigma\cup\bar\Sigma$ decide whether it accepts a string such that the unbarred part equ...
null
Speeding up a new floating-point unit by 2 slows down data cache accesses by 2/3 (or a 1.5 slowdown for data caches). If old FP unit took 20% of program's execution time and data cache accesses took 10% of program's execution time, what is the overall speed up? I solved this problem using amdahl's law: FeFP = ...
Using Amdahl's law how do you determine execution time after an improvement?
|computer-architecture|
This is a homework problem for my introduction to algorithms course. >Recall the scheduling problem from Section 4.2 in which we sought to minimize the maximum lateness. There are $n$ jobs, each with a deadline $d_i$ and a required processing time $t_i$, and all jobs are available to be scheduled starting at time...
Maximum Schedulable Set Zero-Lateness Deadline Scheduling
|dynamic-programming|
(Partial answer/Too long for comment) Note that if $|T| \neq |A|$, we can introduce dummy tasks or agents carrying zero profit, and make the cardinalities equal. Let $t_d,a_d$ be respectively the number of dummy tasks and agents. Suppose now that the tasks are $T_1,\ldots T_s$ and the agents are $A_1,\ldots,A_s$. Let ...
Since the FP speedup <i> slows down </i> the cache by a factor of $2/3$, the cache is "sped up" by $3/2$. Hence the overall speedup is $ S = \frac{1}{0.7 + 0.2/2 + 0.1 \times \frac {3}{2}} = 1.05 \equiv 5\%$ The execution times now have the ratio: $0.7:0.1:0.15$ for remaining operations:FP:cache. The percentage t...
null
I have been thinking about why the dynamic programming approach to finding the optimal matrix chain order is better than a brute force approach that finds the optimal order by exploring all nested orders. The more I think about it, the more I feel strongly that the dynamic programming solution considers all possible ch...
I have been thinking about why the dynamic programming approach to finding the optimal matrix chain order is better than a brute force approach that finds the optimal order by exploring all nested orders. The more I think about it, the more I feel strongly that the dynamic programming solution considers all possible ch...
Speeding up a new floating-point unit by 2 slows down data cache accesses by a factor of 2/3 (or a 1.5 slowdown for data caches). If old FP unit took 20% of program's execution time and data cache accesses took 10% of program's execution time, what is the overall speed up? I solved this problem using amdahl's law:...
$H(x)$ is the program size complexity of $x$ for some universal Turing machine $U$. $H$ is not computable, however $H$ is *computable in the limit from above*. From my notes: >i.e the set $\{(x,n) | x \in B^*,n \geq 0, H(x) \leq n\}$ is computably enumerable. Can someone tell me what this means? I understand ...
What does 'computable in the limit from above' mean?
|complexity-theory|space-complexity|
$H(x)$ is the program size complexity of $x$ for some universal Turing machine $U$. $H$ is not computable, however $H$ is *computable in the limit from above*. From my notes: >i.e the set $\{(x,n) \mid x \in B^*,n \geq 0, H(x) \leq n\}$ is computably enumerable. Can someone tell me what this means? I understa...
|complexity-theory|
Here is my prove,but not sure it is correct or not: We know: $\begin{array}{l} \forall {c_1},\exists {n_1},0 \le f\left( n \right) \le {c_1}g\left( n \right),\forall n \ge {n_1} \\ \forall {c_1},\exists {n_2},0 \le g\left( n \right) \le {c_1}h\left( n \right),\forall n \ge {n_2} \\ \end{array}$ Hope to...
How to prove Transitivity in small-o of Asymptotic analysis?
|asymptotics|
I'm a none-computer-science-student and get some knowledge on AI by taking the CS188.1x Course (Artificial Intelligence) on www.edx.org . Currently, I am working on the "Search in Pacman" Project; the sources can be found online at [Berkley CS188][1] . I have problems finding an good solution for "Finding All the Co...
Heuristic for Finding Multiple Goals in Graph - e.g. using Kruskals Algorithm
|algorithms|graphs|heuristics|search-problem|
In my variant of the assignment problem I have a set $A$ of agents and a set (of possibly different cardinality) $T$ of tasks. Each agent needs to be assigned exactly $n$ or $n+1$ tasks, and each task needs to be assigned to exactly $m$ or $m+1$ agents. It is guaranteed this this is possible: the segment $\left[ |A|...
null
In my variant of the assignment problem I have a set $A$ of agents and a set (of possibly different cardinality) $T$ of tasks. Each agent needs to be assigned exactly $n$ or $n+1$ tasks, and each task needs to be assigned to exactly $m$ or $m+1$ agents. It is guaranteed this this is possible: the segment $\left[ |A|...
I have a problem that can be reduced to an assignment problem. (In a previous [question][1] i found out how to do that.) Which means we have a set $A$ of agents and a set $T$ of tasks as well as a cost function $c(i,j)$. We need to find an assignment so that the total cost is minimal. The [hungarian algorithm][2...
Assignment problem for multiple days
|algorithms|graphs|assignment-problem|
null
I have a problem that can be reduced to an assignment problem. (In a previous [question][1] i found out how to do that.) Which means we have a set $A$ of agents and a set $T$ of tasks as well as a cost function $c(i,j)$. We need to find an assignment so that the total cost is minimal. The [hungarian algorithm][2...
>This is a problem from Interview Street in Dynamic Programming section. https://www.interviewstreet.com/challenges/dashboard/#problem/4f2c2e3780aeb >Billboards(20 points) >ADZEN is a very popular advertising firm in your city. In every road you can see their advertising billboards. Recently they are facing a se...
How can I improve my Algorithm?
|algorithms|data-structures|dynamic-programming|
To show that $f(n) \in o(h(n))$, you need to show that $\lim_{n\rightarrow\infty}\frac{f(n)}{h(n)}=0$. Or, in other words, for any constant $\epsilon$, there exists $N>0$ such that $$ \forall n \geq N\colon |f(n)| \leq \epsilon|h(n)|. \qquad \text{(A)} $$ Since we have assumed $f(n) \in o(g(n))$, we know that for a...
This can be formulated as an instance of min-cost (or in this case, max-profit) flow. Set up a network as follows. There will be four layers. The first layer is a single node we call the source. The next layer consists of a node for each agent. The next layer has a node for each task. The final layer is one node ...
This can be formulated as an instance of min-cost (or in this case, max-profit) flow. Set up a network as follows. There will be four layers. The first layer is a single node we call the source. The next layer consists of a node for each agent. The next layer has a node for each task. The final layer is one node ...
This can be formulated as an instance of min-cost (or in this case, max-profit) flow. Set up a network as follows. There will be four layers. The first layer is a single node we call the source. The next layer consists of a node for each agent. The next layer has a node for each task. The final layer is one node ...
null
null
To quote [Wikipedia][1]/[Scholarpedia][2], > A partial function $f$ from the rational numbers to the real numbers is > **upper semicomputable** if it is defined by a rational-valued partial > computable function $\phi(x,k)$ with $x$ a rational number and $k$ a > nonnegative integer such that $\phi(x,k+1)≤ϕ(x,k)$...
There's a way to this in polynomial time. I'll sketch the algorithm (in reverse order ... do step 2 first and step 1 second). 1. if we can find a set of $nk$ agent-task pairs $(i,j)$ such that each task is in exactly $k$ pairs, each agent is in exactly $k$ pairs, and no pair appears more than once, then we can fi...
Least cost travel by intermixing different airline routes having linear discount functions: Lowest air fare route chosen by mixing different routes provided by different airline having different discount functions(like some airline can give 25 % discount if fare crosses $5k) so that total cost of tra...
Proving following problem NP Hard using known NP Hard partition problem
|complexity-theory|
One question we could ask is "Can we reduce this back to the subset sum problem?" In this case, the answer is **yes**: for each duplicate $z$ we replace it with two numbers $x$ and $y$ such that $x+y=z$. $$[-1,-1,2,3]\to [-7,-1,2,3,6]$$ However, we need to be careful that we don't introduce additional solutions (t...
Least cost travel by intermixing different airline routes having linear discount functions: Lowest air fare route chosen by mixing different routes provided by different airline having different discount functions(like some airline can give 25 % discount if fare crosses $5k) so that total cost of travel is minimized...
|complexity-theory|graphs|
**No**. The easiest way to prove this is by counterexample. Expanding [matching pennies][1], we can create a game with two mixed strategies (players either mix between A and B or between C and D): ![Dual Matching Pennies][2] What *might* be true about that statement is for a mix of particular pure strategies for ...
null
From [Wikipedia][1] about randomized algorithms > One has to distinguish between **algorithms** that use the random > input to reduce the expected running time or memory usage, but always > terminate with a correct result in a bounded amount of time, and > **probabilistic algorithms**, which, depending on the ran...
Classfication of randomized algorithms
|randomized-algorithms|
From [Wikipedia][1] about randomized algorithms > One has to distinguish between **algorithms** that use the random > input to reduce the expected running time or memory usage, but always > terminate with a correct result in a bounded amount of time, and > **probabilistic algorithms**, which, depending on the ran...
|algorithms|terminology|randomized-algorithms|nondeterminism|machine-models|
1) An example of such an algorithm is randomized Quick Sort, where you randomly permute the list or randomly pick the pivot value, then use Quick Sort as normal. Quick Sort has a worst case running time of $O(n^{2})$, but on a random list has an expected running time of $O(n\log n)$, so it always terminates after $O(n^...
null
Given an adjacency matrix $A_G$ of an undirected graph $G$, it is easy and straightforward to compute the characteristic polynomial $\chi_G(\lambda)$. What about the other way around? The problem can be formulated as follows. > **Problem** Given a polynomial $P$, decide whether there is a graph $G$ with the correspo...
This is a homework problem for my introduction to algorithms course. >Recall the scheduling problem from Section 4.2 in which we sought to minimize the maximum lateness. There are $n$ jobs, each with a deadline $d_i$ and a required processing time $t_i$, and all jobs are available to be scheduled starting at time...
Questions on space-efficient probabilistic data structures known as Bloom filters. In membership testing, false positives are possible but false negatives are not.
null
Questions on multigraphs, which are graphs with multiple edges allowed.
null
Questions on the Master theorem, a method for obtaining asymptotic bounds on recurrences of a specific form.
null
Least cost travel by intermixing different airline routes having linear discount functions: Lowest air fare route chosen by mixing different routes provided by different airline having different discount functions (like some airline can give 25% discount if fare crosses $5k) so that total cost of travel is minimized...
Assuming that an "airport" cannot be visited more than once, you can reduce HAMILTONIAN PATH to your problem: given a graph $G = (V,E)$, $|V|=n$; suppose that there are two airlines such that $E(1)=E(2)=E$ (i.e. both airlines cover all edges). Then set the price of each edge = $1$. One of the two companies gives no dis...
I know the general concept of recursion . I came across the concept of tail recursion while studying up on Quick sort algorithm . But I am not clear in my mind yet yet as to what is meant by tail recursion . Can some one explain to me the concept with a proper example ?
What is tail recursion?
|algorithms|data-structures|recurrence-relation|recursion|
From [Van Emde Boas trees lecture][1]: > We will use the idea of superimposing a tree of degree ${u^{1/2}}$ on top of > a bit vector, but **shrink the universe size recursively** by a square > root at each tree level. The ${u^{1/2}}$ items on the first level each hold > structures of ${u^{1/4}}$ items, which hold...
I know the general concept of recursion. I came across the concept of **tail recursion** while studying the quicksort algorithm. I am not clear in my mind, what is meant by tail recursion. Can someone explain the concept with a proper example?
|algorithms|reference-request|recursion|
I know the general concept of recursion. I came across the concept of **tail recursion** while studying the quicksort algorithm.However I was through this [video of quick sort algorithm from MIT][1] and at 18:30 seconds the professor says that this is tail recursive algorithm. I am not clear in my mind, what is meant ...