instruction stringlengths 0 29.8k ⌀ |
|---|
There's no correct answer unless you specify what the $n$ functions are.
For example, consider, for each $k$, the function $f_k(n) = kn$. For any fixed $k$, $f_k(n) \in O(n)$.
Yet $\sum_{k=1}^{n} f_k(n) = \sum_{k=1}^n kn = n\frac{n(n+1)}{2} \in O(n^3)$. A different choice of sequence $f_k$ could yield just about ... |
I think you can do this with marching squares, which is both fast and easy to implement.
To use marching squares you need to construct a scalar grid over your domain. Impose a regular grid over your region of interest. For each point in the grid, compute the distance (or time, etc.) between the grid point and your ... |
There's no correct answer unless you specify what the $n$ functions are.
For example, consider, for each $k$, the function $f_k(n) = kn$. For any fixed $k$, $f_k(n) \in O(n)$.
Yet $\sum_{k=1}^{n} f_k(n) = \sum_{k=1}^n kn = n\frac{n(n+1)}{2} \in O(n^3)$. A different choice of sequence $f_k$ could yield just about ... |
I think you can do this with marching squares, which is both fast and easy to implement.
To use marching squares you need to construct a scalar grid over your domain. Impose a regular grid over your region of interest. For each point in the grid, compute the distance (or time, etc.) between the grid point and your ... |
You can describe what's going on here with the notion of a functor, extending things which you would do naturally with three different types (ints, chars, and floats) to trees over these types.
What you have is in effect only a single tree, *e.g.*
$$
T = \left\{\mspace{45mu}\begin{array}{c@{}c@{}c}
& (4,a\mspace{... |
null |
I think what you want to say is that you are summing the term $O(n)$, $O(k)$ times for $1 \leq k \leq n$ . right? In this case, the answer is $O(nk)$.
If $O(k) \in O(n)$ (for example $k = n/c$ for $c \in O(1)$) then, then the answer is $O(n^2)$. is that what you want ?
I see from the comments $k = 3$. Therefor... |
I think I understood you from your comments above. I think you have issues in the very basics of complexity analysis.
I think what you want to say is that you are summing the term $O(n)$, $O(k)$ times for $1 \leq k \leq n$ . right? In this case, the answer is $O(nk)$.
If $O(k) \in O(n)$ (for example $k = n/c$... |
null |
L = {w1w2| there are two words, x,y such that : xw1 is in L1, w2y is in L2} is regular if L<sub>1</sub> and L<sub>2</sub> are regular languages.
> L<sub>suff</sub> = { w<sub>1</sub> | xw<sub>1</sub> ∈ L<sub>1</sub> }
> L<sub>pref</sub> = { w<sub>2</sub> | w<sub>2</sub>y ∈ L<sub>2</sub> }
**An... |
Let's break it down.
First, let's look at $[-a]\phi$. This means every non-$a$ transition leads to a state where $\phi$ holds. It follows then that $[-a]\mathrm{ff}$ holds for states that have no non-$a$ transitions, which we will use when looking at the least fixed point semantics.
$\langle-\rangle\mathrm{tt}$ i... |
I would suggest the following. The data you extracted from OSM is not enough. A DAG only represents the combinatorial data, but not the topological data. What you should do is to sort for every vertex of the DAG the emanating edges in cyclic order, say ccw. Also I would forget about the directions of the edges. With th... |
In [Fibonacci heaps][1], we keep a mark field for every node in the heap. Initially all the nodes are unmarked. Once a node is deleted, its parent is marked. If a node is deleted and its parent is already marked, the parent will be cut and inserted into the root list. I just wonder what the purpose of marking is? What ... |
What is the purpose of Mark field in Fibonacci Heaps? |
|data-structures|time-complexity|heaps| |
Realize that STRIPS solves *linear* planning problems. By this I mean those planning tasks where the order in which the goals are satisfied is not relevant and these are, in practice, easier to solve than the *non-linear* planning problems ---be aware, however, that STRIPS is PSPACE-complete anyway and it is necessary ... |
For 2D polygonal meshes, the QuadEdge and HalfEdge data structure representations are sufficient to store and enable efficient query of all topological and incidence information. Are there compact and efficient data structures for 3D polyhedral meshes? I know there has been some recent work on compact representations f... |
Data structures for general (non-tetrahedral) cell complexes |
|data-structures|computational-geometry| |
It does change the complexity of the operations. Simply speaking, the root list $W$ gets too large.
We have two *expensive* operations, which are **ExtractMin** and **DecreaseKey**. Remember that the amortized analyisis uses the potential function
$$ \Phi(F)=|W| +2\cdot \text{# marks}. $$
If we call **ExtractMin**... |
It does change the complexity of the operations. Simply speaking, the root list $W$ gets too large.
We have two *expensive* operations, which are **ExtractMin** and **DecreaseKey**. Remember that the amortized analyisis uses the potential function
$$ \Phi(F)=|W| +2\cdot \text{# marks}. $$
If we call **ExtractMin**... |
|data-structures|heaps|amortized-analysis| |
null |
null |
Realize that STRIPS solves *linear* planning problems. By this I mean those planning tasks where the order in which the goals are satisfied is not relevant and these are, in practice, easier to solve than the *non-linear* planning problems ---be aware, however, that STRIPS is PSPACE-complete anyway and it is necessary ... |
null |
> Strips –Stands for STanford Research Institute Problem Solver (1971).
**STRIPS Pseudo code -**
STRIPS(stateListstart, stateListgoals)
1.Set state = start
2.Set plan = []
3.Set stack = goals
4.while stack is not empty do
1.STRIPS-Step()
5.Return plan
STRIPS-Step(... |
How to recognize a STRIPS planning problem has no solution? |
null |
I try to solve exercise "on the power of double - logarithmic space" from the great textbook [Computational Complexity by Oded Goldreich. ](http://books.google.com/books?id=EuguvA-w5OEC&pg=PA176&lpg=PA176&redir_esc=y#v=onepage&q&f=false)
The goal is to show that the given set $S=\left \{ w_k,k \in N \right \}$, where ... |
Power of Double - Logarithmic Space |
|complexity-theory|space-complexity| |
I try to solve exercise "on the power of double - logarithmic space" from the great textbook [Computational Complexity by Oded Goldreich. ](http://books.google.com/books?id=EuguvA-w5OEC&pg=PA176&lpg=PA176&redir_esc=y#v=onepage&q&f=false)
The goal is to show that the given set $S=\left \{ w_k \mid k \in \mathbb{N} \rig... |
A Turing machine is a simple theoretical/conceptual computational device based on state. Computation is done through state transitions based on the machines current state. It is popular in Computer Science theory due to how models and proofs can be built off of it. Wikipedia has a far more detailed write up on Turin... |
I've been reading a lot of computer science literature in the recent past but haven't ran across an explanation of Turing machines, the different types, and why they seem to come up so often (I understand they are a sort of a basis for CS topics).
I've also seen comments by some members mentioning turing-completen... |
Looking for some more details on "Turing" devices |
|untagged| |
Well, the set $\left \{w_1**w_2**..**w_k \right \}$ contains only one single element, but is nevertheless a set. And TM can accept only languages, which are sets of words.
Why is it slightly easier? Hmm, I would say, it is easier since you can simplify the algorithm **slightly**. You have one counter for $k$, and th... |
|turing-machines|computation-models|turing-completeness| |
null |
Your conjecture is disproved by Keith Ellul, Bryan Krawetz, Jeffrey Shallit and Ming-wei Wang in their paper "Regular Expressions: New Results and Open Problems". While the paper is not available on-line, a [talk][1] is.
In the paper, they define the measure $|\mathrm{alph}(R)|$, which is the number of symbols in $R... |
A Turing machine is a simple theoretical/conceptual computational device based on state. Computation is done through state transitions based on the machines current state. It is popular in Computer Science theory due to how models and proofs can be built off of it. Wikipedia has a far more detailed write up on Turin... |
null |
> The "Turing" machine was described in 1936 by Alan Turing[1] who called it an "a-machine"
> (automatic machine). The Turing machine is not intended as practical
> computing technology, but rather as a hypothetical device representing
> a computing machine. Turing machines help computer scientists
> understand th... |
null |
hi there my problem is it possible to prove that a language is unambiguous ? For example i have homework question which is like
S -> A1B
A -> 0A | ε
B -> 0B | 1B | ε
-Show that this grammar is unambiguous.
-Find a grammar for the same language that is ambiguous, and
demonstrate it.
i know if... |
how to show that given language is unambiguous |
|automata|context-free|proof-techniques|ambiguity| |
To show a grammar is unambiguous you have to argue that for each string in the language there is only one derivation tree.
In this particular case you can observe that $A$ only generates $0$'s, so the $1$ generated by the start symbol $S$ must be the first $1$ in the string.
Any grammar can be made ambiguous by ... |
null |
null |
A Turing machine is named after British mathematician Alan Turing; he first described them in his paper "On computable numbers, with an application to the Entscheidungsproblem". It serves as the mathematical basis of computation and allowed various notions of computability to be mathematically proven even before physi... |
|terminology|turing-machines|computation-models|turing-completeness| |
I have a homework assignment:
Given following grammar
$
S \rightarrow A1B \\
A \rightarrow 0A \;|\; \varepsilon \\
B \rightarrow 0B \;|\; 1B \;|\; \varepsilon \\
$
* Show that this grammar is unambiguous.
* Find a grammar for the same language that is ambiguous, and demonstrate it.
I know if I was ... |
How to show that given language is unambiguous |
|formal-languages|context-free|proof-techniques| |
null |
I have a homework assignment:
Given following grammar:
$$
\begin{align}
S \rightarrow &A1B \\
A \rightarrow & 0A \mid \varepsilon \\
B \rightarrow & 0B \mid 1B \mid \varepsilon \\
\end{align}
$$
* Show that this grammar is unambiguous.
* Find a grammar for the same language that is ambiguous, and demo... |
Given n jobs, schedule them such that the weighted sum is minimum.
weighted minimum sum S for the schedule $\sigma = \{ J_1, J_2, ... J_n \}$ is given by :
$S = \sum_{1\leqq i \leqq n} w_i C_i\ where \ C_i\ = \sum_{1\leqq j \leqq i} t_j\ and\ w_i\ is\ the\ weight\ of\ job\ J_i,\ t_i\ is\ the\ time\ J_i takes\... |
Single machine job scheduling |
|algorithms| |
Given $n$ jobs, schedule them such that the weighted sum is minimum.
weighted minimum sum S for the schedule $\sigma = \{ J_1, J_2, ... J_n \}$ is given by :
$S = \sum_{1\leqq i \leqq n} w_i C_i$ where $C_i\ = \sum_{1\leqq j \leqq i} t_j$ and $w_i$ is the weight of job $J_i$, $t_i$ is the time $J_i$ takes to co... |
null |
Hint: Let $\sigma$ be the optimal schedule. Suppose that jobs $k$ and $k+1$ are switched. How is the cost affected? What does the optimality of $\sigma$ tell us about $w_k,w_{k+1},t_k,t_{k+1}$? |
Let $L_\epsilon$ be the language of all $2CNF$ formulas $\varphi$, such that at least $(\frac{1}{2}+\epsilon)$ of $\varphi$'s clauses can be satisfied.
I need to prove that there exists $\epsilon'$ s.t $L_\epsilon$ is $NP-hard$ for any $\epsilon<\epsilon'$.
We know that $Max2Sat$ can be approximate to $\frac{55}{... |
Find $\epsilon'$ s.t $L_\epsilon$ is $NP-hard$ for any $\epsilon<\epsilon'$ |
|complexity-theory|approximation| |
There is an extension of half-edge in any dimension, called combinatorial maps.
There are two packages in CGAL allowing to use these combinatorial maps in any dimension (see http://www.cgal.org/Pkg/CombinatorialMaps and http://www.cgal.org/Pkg/LinearCellComplex).
Thus you can use this data structure do describe any... |
Let $L_\epsilon$ be the language of all $2CNF$ formulas $\varphi$, such that at least $(\frac{1}{2}+\epsilon)$ of $\varphi$'s clauses can be satisfied.
I need to prove that there exists $\epsilon'$ s.t $L_\epsilon$ is $NP$-$hard$ for any $\epsilon<\epsilon'$.
We know that $Max2Sat$ can be approximate to $\frac{55... |
Find $\epsilon'$ s.t $L_\epsilon$ is $NP$-$hard$ for any $\epsilon<\epsilon'$ |
null |
null |
Assume i have 2 numbers in binary form (or, more precisely, assume to know the number of their digits, DF1, DF2):
101010101001010101010101010111111111111111111111010101
10101111111111111111010101
Is there a formula for the exact number of binary digits (DP) of the product?
DP = F (DF1, DF2)
[I need t... |
Number of digits in a binary product |
|factoring| |
There are polynomial time algorithms to find maximum weighted matching in a general graph. Is there any algorithm that also handles negative weights in the general graph and find maximum weighted matching for that graph with negative weights ?
If yes, then please attach the link to the algorithm.
thanks |
Maximum weight matching |
|untagged| |
I assume you want to know the *maximum* possible bits that a product of two numbers might have. Under that assumption, let the first number $a$ have $m$ bits, and the second number $b$ have $n$ bits.
Then, $$a \leq 2^{m} - 1 $$
Similarly, $$b \leq 2^{n} - 1$$
Then, the product is:
$$a \cdot b = 2^{m+n} - 2^m - ... |
I assume you want to know the *maximum* possible bits that a product of two numbers might have. Under that assumption, let the first number $a$ have $m$ bits, and the second number $b$ have $n$ bits.
Then, $$a \leq 2^{m} - 1 $$
Similarly, $$b \leq 2^{n} - 1$$
Then, the product is:
$$a \cdot b = 2^{m+n} - 2^m - ... |
I assume you want to know the *maximum* possible bits that a product of two numbers might have. Under that assumption, let the first number $a$ have $m$ bits, and the second number $b$ have $n$ bits.
Then, $$a \leq 2^{m} - 1 $$
Similarly, $$b \leq 2^{n} - 1$$
Then, the product is:
$$a \cdot b = 2^{m+n} - 2^m - ... |
I assume you want to know the *maximum* possible bits that a product of two numbers might have. Under that assumption, let the first number $a$ have $m$ bits, and the second number $b$ have $n$ bits.
Then, $$a \leq 2^{m} - 1 $$
Similarly, $$b \leq 2^{n} - 1$$
Then, the product is:
$$a \cdot b \leq 2^{m+n} - 2^m... |
null |
There is an extension of half-edge in any dimension, called combinatorial maps.
There are two packages in CGAL allowing to use these combinatorial maps in any dimension (see [here for combinatorialMaps](http://www.cgal.org/Pkg/CombinatorialMaps) and [here for LinearCellComplex](http://www.cgal.org/Pkg/LinearCellComple... |
Let $L_\epsilon$ be the language of all $2$-CNF formulas $\varphi$, such that at least $(\frac{1}{2}+\epsilon)$ of $\varphi$'s clauses can be satisfied.
I need to prove that there exists $\epsilon'$ s.t $L_\epsilon$ is $\mathsf{NP}$-hard for any $\epsilon<\epsilon'$.
We know that $\text{Max}2\text{Sat}$ can be ap... |
Find $\epsilon'$ s.t $L_\epsilon$ is $\mathsf{NP}$-hard for any $\epsilon<\epsilon'$ |
I assume you want to know the *maximum* possible bits that a product of two numbers might have. Under that assumption, let the first number $a$ have $m$ bits, and the second number $b$ have $n$ bits.
Then, $$a \leq 2^{m} - 1 $$
Similarly, $$b \leq 2^{n} - 1$$
Then, the product is:
$$a \cdot b \leq 2^{m+n} - 2^m... |
null |
null |
In his famous paper, [Håstad][1] shows that it is NP-hard to approximate MAX2SAT better than $21/22$. This likely means that is is NP-hard to distinguish instances which are $\leq \alpha$ satisfiable and instances which are $\geq (22/21) \alpha$ satisfiable, for some $\alpha \geq 1/2$. Now imagine padding an instance s... |
Let $a.b = c$
$\log a + \log b = \log c$
Length of a number $n$ in base $b$ is $\lceil \log_bn\rceil$.
So $\lceil\log_2 a + \log_2 b\rceil$ bits should be enough.
|
Let $a.b = c$
$\log a + \log b = \log c$
Length of a number $n$ in base $b$ is $\lceil \log_b (n + 1)\rceil$.
So $\lceil\log_2 (a + 1) + \log_2 (b + 1)\rceil$ bits should be enough.
|
null |
I was only familiar with the Hungarian algorithm which only works for bipartite graphs but I've found something that claims to work for general graphs as well.
The basic algorithm is the [blossom algorithm](http://en.wikipedia.org/wiki/Edmonds%27s_matching_algorithm), but since you need to find the maximum weight matc... |
null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.