instruction stringlengths 0 29.8k ⌀ |
|---|
|algorithms| |
Given an integer sequence $\{ a_1, a_2, \ldots, a_n \}$ that has length $n$, and an integer $k<n$ the [problem][1] is to find a subset $A\subset [n]$ such that
1. $|A|=k$
2. The value $$ \sum_{i\in A} i \cdot a_i$$ is maximized.
----------
For instance, if the given sequence is $50; 100; 20; 40; 30$ an... |
|algorithms|optimization| |
Given an integer sequence $\{ a_1, a_2, \ldots, a_n \}$ that has length $n$, and an integer $k<n$ the [problem][1] is to find a subset $A\subset [n]$ such that
1. $|A|=k$
2. The value $$ \sum_{i\in A, j=1}^k j \cdot a_i$$ is maximized.
----------
For instance, if the given sequence is $50; 100; 20; 40;... |
Consider an array $X$ of $n$ cells, each containing a number from $\{1,..., n\}$. There is at least
one duplicate number, i.e., a number that appears at least twice. I want output _some_ duplicate number. When streaming we may pass over $X$ more than once. The inspection of a cell generates cost $1$. The cost of a run... |
Consider an array $X$ of $n$ cells, each containing a number from $\{1,..., n\}$. There is at least
one duplicate number, i.e., a number that appears at least twice. I want output _some_ duplicate number. When streaming we may pass over $X$ more than once. The inspection of a cell generates cost $1$. The cost of a run... |
Given an integer sequence $\{ a_1, a_2, \ldots, a_n \}$ that has length $n$, and an integer $k<n$ the [problem][1] is to find a subset $A\subset [n]$ such that
1. $|A|=k$
2. The value $$ \sum_{i\in A, j=1}^k j \cdot a_i$$ is maximized.
----------
For instance, if the given sequence is $-50; 100; -20; 4... |
I was fooling around with [Google Blocky's Maze demo](http://neil.fraser.name/software/blockly/demos/maze/index.html), and remembered the old rule that if you want to solve a maze, just keep your left hand to the wall. This works for any simple-connected maze and can be implemented by a finite transducer.
Let our ro... |
Optimal myopic maze solver |
|finite-automata|artificial-intelligence| |
Let me first quote the problem formulation from the [PDF][1]
> Given a sequence of $N$ integer numbers $a_1, a_2, \ldots , a_n$ and a fixed value $M \leq N$. For each subsequence of positions $1 \leq i_1 < i_2 < \ldots < i_M \leq N$, we compute the weighted sum
$$\Sigma_{j=1}^{M} j\cdot a_{i_j} $$
The aim is to fi... |
Let me first quote the problem formulation from the [PDF][1]
> Given a sequence of $N$ integer numbers $a_1, a_2, \ldots , a_n$ and a fixed value $M \leq N$. For each subsequence of positions $1 \leq i_1 < i_2 < \ldots < i_M \leq N$, we compute the weighted sum
$$\Sigma_{j=1}^{M} j\cdot a_{i_j} $$
The aim is to fi... |
Let me first quote the problem formulation from the [PDF][1]
> Given a sequence of $N$ integer numbers $a_1, a_2, \ldots , a_n$ and a fixed value $M \leq N$. For each subsequence of positions $1 \leq i_1 < i_2 < \ldots < i_M \leq N$, we compute the weighted sum
$$\Sigma_{j=1}^{M} j\cdot a_{i_j} $$
The aim is to fi... |
null |
Let me first quote the problem formulation from the [PDF][1]
> Given a sequence of $N$ integer numbers $a_1, a_2, \ldots , a_n$ and a fixed value $M \leq N$. For each subsequence of positions $1 \leq i_1 < i_2 < \ldots < i_M \leq N$, we compute the weighted sum
$$\Sigma_{j=1}^{M} j\cdot a_{i_j} $$
The aim is to fi... |
Let me first quote the problem formulation from the [PDF][1]
> Given a sequence of $N$ integer numbers $a_1, a_2, \ldots , a_n$ and a fixed value $M \leq N$. For each subsequence of positions $1 \leq i_1 < i_2 < \ldots < i_M \leq N$, we compute the weighted sum
$$\Sigma_{j=1}^{M} j\cdot a_{i_j} $$
The aim is to fi... |
**Question 1**
I think your definition of *better* is too strict (but I don't have any nice
definition).
We build a family of mazes $R=(R_i)_i$. Each one $R_i$ is a corridor of length $i$ that ends with a turn on the right. The same with $L$ and left, respectively.
We can build a transducer $A_R$ that optima... |
|algorithms|randomized-algorithms|randomness|streaming-algorithm| |
|automata|finite-automata|artificial-intelligence| |
**Question 1**
I think your definition of *better* is too strict in the sense that *finite* is too restrictive (but I don't have any better definition).
We build a family of mazes $R=(R_i)_i$. Each one $R_i$ is a corridor of length $i$ that ends with a turn on the right. The same with $L$ and left, respectively. ... |
**Question 1**
I think your definition of *better* is too strict in the sense that *finite* is too restrictive (but I don't have any better definition).
We build a family of mazes $R=(R_i)_i$. Each one $R_i$ is a corridor of length $i$ that ends with a turn on the right. The same with $L$ and left, respectively. ... |
(About question 1)
I think your definition of *better* is too strict in the sense that *finite* is too restrictive (but I don't have any better definition).
We build a family of mazes $R=(R_i)_i$. Each one $R_i$ is a corridor of length $i$ that ends with a turn on the right. The same with $L$ and left, respective... |
null |
**Question 1**
I think your definition of *better* is too strict in the sense that *finite* is too restrictive (but I don't have any better definition).
We build a family of mazes $R=(R_i)_i$. Each one $R_i$ is a corridor of length $i$ that ends with a turn on the right. The same with $L$ and left, respectively. ... |
My question is, if a weighted graph G has two different minimum spanning trees $T_1 = (V_1, E_1)$ and $T_2 = (V_2, E_2)$, then is it true that for any edge $e$ in $E_1$, the number of edges in $E_1$ with the same weight as $e$ (including $e$ itself) is the same as the number of edges in $E_2$ with the same weight as $e... |
If multiple MSTs exist for a graph, what can be said about them? |
|graphs| |
My question is, if a weighted graph G has two different minimum spanning trees $T_1 = (V_1, E_1)$ and $T_2 = (V_2, E_2)$, then is it true that for any edge $e$ in $E_1$, the number of edges in $E_1$ with the same weight as $e$ (including $e$ itself) is the same as the number of edges in $E_2$ with the same weight as $e... |
Yves Caseau gave a method for efficiently encoding type hierarchies as bit vectors. See "Efficient handling of multiple inheritance hierarchies," http://dl.acm.org/citation.cfm?id=165905 |
What would be the standard topics covered in an 'Advanced Placement Computer Science A" test? Is there any good study references someone can share? This is a standard college CS entry level test I assume for people with a good amount of experience.
If this is not a appropriate question please let me know and don't... |
Advanced placement CS A Exam |
|reference-request| |
What would be the standard topics covered in an 'Advanced Placement Computer Science A" test? Is there any good study references someone can share? This is a standard college CS entry level test I assume for people with a good amount of experience.
If this is not a appropriate question please let me know and don't... |
What would be the standard topics covered in an 'Advanced Placement Computer Science A" test? Is there any good study references someone can share? This is a standard college CS entry level test I assume for people with a good amount of experience.
If this is not a appropriate question please let me know and don't... |
|reference-request|learning-theory| |
What would be the standard topics covered in an 'Advanced Placement Computer Science A" test? Is there any good study references someone can share?
**Edit: Answer**
Okay I feel a little stupid for not looking harder,but an adjustment for my search term returned a wikipedia page just for this type of exam and the... |
null |
If a weighted graph $G$ has two different minimum spanning trees $T_1 = (V_1, E_1)$ and $T_2 = (V_2, E_2)$, then is it true that for any edge $e$ in $E_1$, the number of edges in $E_1$ with the same weight as $e$ (including $e$ itself) is the same as the number of edges in $E_2$ with the same weight as $e$? If the stat... |
Do the minimum spanning trees of a weighted graph have the same number of edges with a given weight? |
|graphs|spanning-trees|weighted-graphs| |
If I understood well the question, I think that you can apply a speedup trick to get faster automata (on an infinite number of mazes): you can simply use its states to store a finite number of steps and recognize dead ends like the one in the figure:
![enter image description here][1]
When the automaton is in pos... |
If I understood well the question, I think that you can apply a speedup trick to get faster automata on an infinite number of mazes (providing that the exit is located on one of the border): you can simply use its states to store a finite number of steps and recognize dead ends like the one in the figure:
![enter im... |
If I understood well the question, I think that you can apply a speedup trick to get faster automata on an infinite number of mazes (providing that the exit is placed on one of the border): you can simply use the internal states to store a finite number of steps and recognize dead ends like the one in the figure:
![... |
Due to the dubious nature of the question, I only provide hints.
Have you tried the obvious? With probability $\frac{1}{n}$, add the new element to the sample. If it is added, choose one of the elements already in the sample uniformly at random and drop it. Sounds about fair, does it not?
For a proof, you will ha... |
null |
Is it possible to show the minimum vertex cover in a bipartite graph can be reduced to maximum flow? Or to minimum cut problem(then follow max-flow min-cut theorem, the claim holds).
It is intuitively for each flow, pick one endpoint, then it is a minimum vertex cover in bipartite graph. But how to show it rigorousl... |
How to show that the minimum vertex cover in a bipartite graph can be reduced to maximum flow? |
|complexity-theory|reductions| |
According to [König's_theorem][1], the size of minimum vertex cover in bipartite graph $G$ equals to the size of maximum matching in $G$, and there is an obvious reduction from maximum matching in bipartite graph to maxflow problem.
[1]: http://en.wikipedia.org/wiki/K%C3%B6nig%27s_theorem_%28graph_theory%29 |
What would be the standard topics covered in an 'Advanced Placement Computer Science A" test? Is there any good study references someone can share?
**Edit: Answer**
Okay I feel a little stupid for not looking harder, but an adjustment for my search term returned a wikipedia page just for this type of exam and th... |
|reference-request| |
If I understood well the question, I think that you can apply a speedup trick to get faster automata on an infinite number of mazes (providing that the exit is placed on one of the border): you can simply use the internal states to store a finite number of steps and recognize dead ends like the one in the figure:
![... |
I used the following book as a resource material and it was pretty good:
> [Barron's AP Computer Science A][1]
You can see the book preview there along with the contents.
[1]: http://www.amazon.com/Barrons-AP-Computer-Science-A/dp/0764143735 |
According to [König's theorem][1], the size of minimum vertex cover in bipartite graph $G$ equals to the size of maximum matching in $G$, and there is an obvious reduction from maximum matching in bipartite graph to maxflow problem.
[1]: http://en.wikipedia.org/wiki/K%C3%B6nig%27s_theorem_%28graph_theory%29 |
null |
Is it possible to show that the minimum vertex cover in a bipartite graph can be reduced to a maximum flow problem? Or to the minimum cut problem (then follow max-flow min-cut theorem, the claim holds).
Intuitively: for each flow, pick one endpoint, then it is a minimum vertex cover in bipartite graph. But can it be... |
Reducing minimum vertex cover in a bipartite graph to maximum flow |
|complexity-theory|graphs|reductions| |
Given an integer sequence $\{ a_1, a_2, \ldots, a_n \}$ that has length $n$ and a fixed integer $k<n$, the [problem][1] is to find a subset $A =\{i_1, \dots, i_k\} \subseteq [n]$ with $1 \leq i_1 \lt i_1 \lt \dots \lt i_k \leq n$ such that
$\qquad \displaystyle \sum_{j=1}^k j \cdot a_{i_j}$
is maximized.
-... |
|algorithms|reference-request|optimization| |
This problem can be solved by means of dynamic programming. One of the best known dynamic programming algorithms is for the [knapsack problem][2]. It may be instructive to compare the two problems.
Let $C(n,m)$ denote the solution to the maximal weighted sum problem
for the sequence $a_1, a_2, \ldots a_n$ with a... |
Given an integer sequence $\{ a_1, a_2, \ldots, a_N \}$ that has length $N$ and a fixed integer $M\leq N$, the [problem][1] is to find a subset $A =\{i_1, \dots, i_M\} \subseteq [N]$ with $1 \leq i_1 \lt i_1 \lt \dots \lt i_M \leq N$ such that
$\qquad \displaystyle \sum_{j=1}^M j \cdot a_{i_j}$
is maximized.
... |
|algorithms|optimization| |
Yves Caseau gave a method for efficiently encoding type hierarchies as bit vectors. See [Efficient handling of multiple inheritance hierarchies](http://dl.acm.org/citation.cfm?id=165905). |
**Claim:** Yes, that statement is true.
**Proof Sketch:** Let $T_1,T_2$ be two minimal spanning trees with edge-weight multisets $W_1,W_2$. Assume $W_1 \neq W_2$ and denote their [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) with $W = W_1 \mathop{\Delta} W_2$.
Choose edge $e \in T_1 ... |
null |
What would be the standard topics covered in an 'Advanced Placement Computer Science A' test? Is there any good study reference someone can share?
**Edit: Answer**
Okay I feel a little stupid for not looking harder, but an adjustment for my search term returned a [Wikipedia page][1] just for this type of exam an... |
|reference-request|education| |
$L=\{<M,x> ∣ M's \mbox{ transition function can only move right and } M\mbox{ halts on } x \}$.I need to Show that $L \in R$.
I thought of checking the encoding of $M$ first and determine whether its transition function moves only right (Can I do that?), If so then to try to simulate running of $x$ on $M$ for $Q... |
$L=\{<M,x> ∣ M's \mbox{ transition function can only move right and } M\mbox{ halts on } x \}$. Show that $L \in R$ |
|formal-languages|turing-machines| |
$L=\{<M,x> ∣ M's \mbox{ transition function can only move right and } M\mbox{ halts on } x \}$.I need to Show that $L \in R$.
I thought of checking the encoding of $M$ first and determine whether its transition function moves only right (Can I do that?), If so then to try to simulate running of $x$ on $M$ for $Q... |
$L=\{<M,x> ∣ M's $ transition function can only move right and $M$ halts on $ x \}$. Show that $L \in R$ |
$L=\{<M,x> ∣ M's \mbox{ transition function can only move right and } M\mbox{ halts on } x \}$.I need to Show that $L \in R\mbox{(set of recursive languages)}$
I thought of checking the encoding of $M$ first and determine whether its transition function moves only right (Can I do that?), If so then to try to s... |
$L=\{<M,x> ∣ M's \mbox{ transition function can only move right and } M\mbox{ halts on } x \}$.I need to Show that $L \in R\mbox{(set of recursive languages)}$
I thought of checking the encoding of $M$ first and determine whether its transition function moves only right (Can I do that?), If so then to try to s... |
$L=\{<\!M,x\!>\, \mid M's \text{ transition function can only move right and } M\text{ halts on } x \}$. I need to show that $L$ is recursive/decidable.
I thought of checking the encoding of $M$ first and determine whether its transition function moves only right (Can I do that?). If so then try to simulate $M$ ... |
Show that the halting problem is decidable for one-pass Turing machines |
|formal-languages|turing-machines|check-my-proof| |
I assume $Q$ is the number of states of $M$. If so, this runtime bound does not make much sense; in particular, a Turing machine with three states can move to the end of the input and check whether $x$ is an even number; it is clearly not enough to wait three steps.
The next question is whether there *is* a computab... |
|formal-languages|computability|turing-machines|check-my-proof| |
null |
null |
I assume $Q$ is state set of $M$. If so, this runtime bound does not make much sense; in particular, a Turing machine with three states can move to the end of the input and check whether $x$ is an even number; it is clearly not enough to wait three steps.
The next question is whether there *is* a computable bound on... |
Here's how to reduce your problem to cycle detection. Your array is a mapping $f$ from $[n]$ to $[n]$. From each starting point $x$, you can iterate $f$. Using a cycle detection algorithm, you can either find out that the iterates of $x$ form a cycle, or find two iterates that map to the same point (your duplicate). Fo... |
null |
I have a game I'm building some ai for that has 2 players making simultaneous moves. In this game there is exactly one move where, if they both make it at the same time, the outcome is different than if they'd made it separately (all other moves are pretty independent).
Anyway, I'm trying to find a good algorithm t... |
Alpha-Beta Pruning with simultaneous moves? |
|artificial-intelligence|search-trees|game-theory| |
Given a language *L = {(a^p)(b^2p) : p >= 1}*, how could I show, using the Pumping Lemma that L is not regular? |
Show that a language is not regular using the Pumping Lemma |
|pumping-lemma| |
null |
Given a language $L = \{a^pb^{2p} \mid p \ge 1\}$, how could I show, using the Pumping Lemma that $L$ is not regular? |
|regular-languages|pumping-lemma| |
null |
The document I am reading is here: [Turing Machines][1]
Before getting into the question, here is the notation used on the picture:
> Here denotes the blank and R, L and S denote move the head right, left
> and do not move it, respectively. A transition diagram can also be
> drawn for a Turing machine. The stat... |
Turing machine and language decidability |
|turing-machines| |
A TM _decides_ a language if it enters the _accepting_ state for word in the language and it enters the _rejecting_ state if it is not. Thus it halts on all inputs.
Machine 1 does not reject words not in the language. It only accepts the language.
Machine 2 does not halt for words not in the language. It only acc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.