instruction stringlengths 0 29.8k ⌀ |
|---|
For (2):
note that machines that in $L_2$ have a strange property - they don't read the entire input (they never reach it's last $c$ bits.) And this is true for *every* input.
Ok, so now let's consider only inputs up to length $c$. For each one of them, there are only two options: the machine loops/halts w/o movin... |
{"Voters":[{"Id":157,"DisplayName":"Ran G."}]} |
null |
The [Litvin book](http://www.amazon.com/Prepared-Computer-Science-Exam-Java/dp/0982477503/ref=sr_1_1?ie=UTF8&qid=1344691713&sr=8-1&keywords=litvin+ap+computer+science) is also pretty good, as is the [Princeton Guide](http://www.amazon.com/Barrons-AP-Computer-Science-A/dp/0764143735/ref=sr_1_2?ie=UTF8&qid=1344691769&sr=... |
I notice that in a few CS research paper, to compare the efficiency of two algorithms, the total number of key comparison in the algorithms is used rather than the real computing times themselves. Why we can't compare which one is better by running the both programs and count the total time needed to run the algorithms... |
comparing two algorithms |
|algorithm-analysis| |
Any situation which asks whether a Turing Machine is confined to a finite section of the tape (say of length $n$) is decidable.
The argument works as follows. Consider the Turing Machine, the tape, and the position of the Turing Machine on the tape. All together these have a finite number of configurations. To be ... |
{"Voters":[{"Id":2118,"DisplayName":"Sam"}]} |
null |
This is because the total time to run the algorithms has a dependency on the hardware in which it is ran on along with other factors. It is not reliable to compare two algorithms if one is running on a Pentium 4 and the other running on, let's say, a Core i7. Not only this, but let's say you ran both on the same comput... |
{"Voters":[{"Id":2118,"DisplayName":"Sam"}]} |
Any situation which asks whether a Turing Machine is confined to a finite section of the tape (say of length $n$) on a given input is decidable.
The argument works as follows. Consider the Turing Machine, the tape, and the position of the Turing Machine on the tape. All together these have a finite number of config... |
Any situation which asks whether a Turing Machine is confined to a finite section of the tape (say of length $n$) on a given input is decidable.
The argument works as follows. Consider the Turing Machine, the tape, and the position of the Turing Machine on the tape. All together these have a finite number of config... |
At [The North Carolina School of Science and Mathematics][1], we have introduced students to Python since 2004. We use it to teach procedural programming, because we think that the ability to write short, correct procedures is vital to progressing later with heavier tools, including OO programming.
We like it for... |
null |
This is actually a deep issue that has some methodic and some pragmatic answers. I assume you want to know something about the *algorithm(s)* at hand. If you want to know which algorithm works better on a given machine on given inputs, go ahead and measure runtimes. If you want to compare the quality of a compiler for ... |
I notice that in a few CS research papers, to compare the efficiency of two algorithms, the total number of key comparison in the algorithms is used rather than the real computing times themselves. Why can't we compare which one is better by running both programs and counting the total time needed to run the algorithms... |
Why use comparisons instead of runtime for comparing two algorithms? |
|algorithms|algorithm-analysis|runtime-analysis| |
Since the other answers explain why we analyze runtime in terms of number of elementary operations, let me offer a couple of reasons for *why comparisons* are the right metric of many (not all) sorting algorithms:
* for many sorting algorithms the number of comparisons dominates the running time, i.e. at least as ma... |
null |
(2) is very similar to (3) and the same reasoning you had for (3) applies here as well:
note that machines that in $L_2$ have a strange property - they don't read the entire input (they never reach it's last $c$ bits.) And this is true for *every* input.
Ok, so now let's consider only inputs up to length $c$. For ... |
Let $S$ be the set of object sizes for the input of a knapsack problem. We consider $S$ under the divisibility relation.
Let $$\alpha(S) = \max( \{|V| |V\subseteq S, V\text{ a antichain }\}) $$
What can we say about the running time of the knapsack problem relate to $\alpha(S)$? It is known that if $\alpha(S) = 1... |
Knapsack problem with many divisibility conditions |
|knapsack-problems| |
Let $S$ be a set of natural numbers. We consider $S$ under the divisibility relation.
Let $$\alpha(S) = \max( \{|V| |V\subseteq S, V\text{ a antichain }\}) $$
If we consider the knapsack problem where the set of object size is $S$, what can we say about the running time of the knapsack problem relate to $\alpha(S... |
It's the classic precision/efficiency tradeoff. You can, in fact, move the meet outside, since $f(x \sqcap y) \sqsubseteq f(x) \sqcap f(y)$. A canonical example of where this makes a difference is in the following constraint-propagation problem:
IF b
x = 1
ELSE
x = -1
y = x*x
The Dra... |
null |
Let $S$ be a set of natural numbers. We consider $S$ under the divisibility relation, i.e. $s_1 \leq_d s_2 \iff s_1 \mid s_2$. Let
$\qquad \displaystyle \alpha(S) = \max \{|V| \mid V\subseteq S, V\text{ an antichain }\}$.
If we consider the knapsack problem where the set of object sizes is $S$, what can we say a... |
|complexity-theory|knapsack-problems| |
It is known that ${\bf \#P}$ is closed under addition, multiplication and binomial coefficient. I was wondering if it is closed under power. For example, we are given a ${\bf \#P}$ function $f$ and another ${\bf \#P}$ function $g$. Is it true that $f^{g}$ or $g^{f}$ are ${\bf \#P}$ functions as well? |
Closure properties of #P functions |
|complexity-theory|turing-machines| |
Let $S$ be a set of natural numbers. We consider $S$ under the divisibility relation, i.e. $s_1 \leq_d s_2 \iff s_1 \mid s_2$. Let
$\qquad \displaystyle \alpha(S) = \max \{|V| \mid V\subseteq S, V\text{ an antichain }\}$.
If we consider the knapsack problem where the set of object sizes is $S$, what can we say a... |
### Background
$\newcommand\ldotd{\mathinner{..}}$Last month, I heard about a new linear-time algorithm to determine the [longest palindromic substring](https://en.wikipedia.org/wiki/Longest_palindromic_substring) called Jeuring's algorithm. It seemed interesting, therefore I had a try to analyze the algorithm. It's... |
null |
null |
There are lots of attempts at proving either $\mathsf{P} = \mathsf{NP} $ or $\mathsf{P} \neq \mathsf{NP}$, and naturally many people think about the question, having ideas for proving either direction.
I know that there are approaches that have been proven to not work, and there are probably more that have a history... |
|complexity-theory|turing-machines|closure-properties| |
null |
## Generating Functions $\newcommand{\nats}{\mathbb{N}}$
Every series of natural numbers corresponds to a [generating function](https://en.wikipedia.org/wiki/Generating_function). It can often be comfortably obtained from a recurrence to have its coefficients -- the series' elements -- plucked.
This answer includ... |
|combinatorics|proof-techniques|asymptotics|recurrence-relation| |
Closure properties of #P. Is it closed under power operator? |
Maybe the most common technique that cannot be used is [relativization](https://en.wikipedia.org/wiki/Relativization), that is, having a TM with oracle access.
The impossibility follows from a paper by [Theodore Baker, John Gill, Robert Solovay](http://dx.doi.org/10.1137/0204037) who show the existence of two oracle... |
Definition:${\bf \#P}$ = $\{f | (\exists$ a nondeterministic polynomial-time Turing machine $M) (\forall x) [f (x) = \#accept_{M}(x)]\}$.
It is known that ${\bf \#P}$ is closed under addition, multiplication and binomial coefficient. I was wondering if it is closed under power. For example, we are given a ${\bf \#P... |
Is #P closed under exponentiation? |
Definition:${\bf \#P}$ = \{$f$ | ($\exists$ a nondeterministic polynomial-time Turing machine $M$) ($\forall x$) [$f$($x$) = $ \#accept_{M}$($x$)]\}.
It is known that ${\bf \#P}$ is closed under addition, multiplication and binomial coefficient. I was wondering if it is closed under power. For example, we are given... |
null |
No. Take f(n)=g(n)=2^n for a counterexample. |
I'm trying to implement the Pastry Distributed Hash Table, but some things are escaping my understanding. I was hoping someone could clarify.
**Disclaimer**: I'm not a computer science student. I've taken precisely two computer science courses in my life, and neither dealt with anything remotely complex. I've worked... |
How Does Populating Pastry's Routing Table Work? |
|algorithms|distributed-systems| |
For fun I am trying to make a wire-frame viewer for the [DCPU-16][1]. I understand how do do everything except how to hide the lines that are hidden in the wire frame. All of the questions here on SO all assume you have access to OpenGL, unfortunately I do not have access to anything like that for the DCPU-16 (or any k... |
How to find contour lines for Appel's Hidden Line Removal Algorithm |
|graphics| |
|algorithms|computational-geometry|graphics| |
null |
I'm interested in a discrete max-convolution problem, which is to compute
$$r(c) = \max_{x | x \ge 0, \sum_k x_k = c} \left[ \sum_{k=1} f_k(x_k) \right] $$
for all values $c=0, \ldots, C$, where $x=(x_1, \ldots, x_k)$ is a vector of non-negative integers.
If we assume that $f_k$ are all concave functions i.e., $f... |
Fast algorithm for max-convolution with concave functions? |
|algorithms| |
I'm interested in a discrete max-convolution problem, which is to compute
$$r(c) = \max_{x | x \ge 0, \sum_k x_k = c} \left[ \sum_{k=1} f_k(x_k) \right] $$
for all values $c=0, \ldots, C$, where $x=(x_1, \ldots, x_k)$ is a vector of non-negative integers.
If we assume that $f_k$ are all concave functions i.e., $f... |
I didn't believe it, so I dusted off my rusty combinatorics skills and tried to figure it out. Here's what I have so far:
From the online ordering site I got the choices
1. crust (4 types, choose 1)
2. size (4 types, choose 1) some crusts are limited to a certain size - not accounting for that, but would like... |
pizza commercial claim of 34 million combinations |
|combinatorics| |
The complexity class $\newcommand{\sharpp}{\mathsf{\#P}}\sharpp$ is defined as
$\qquad \displaystyle \sharpp = \{f \mid \exists \text{ polynomial-time NTM } M\ \forall x.\, f(x) = \#\operatorname{accept}_{M}(x)\}$.
It is known that $\sharpp$ is closed under addition, multiplication and binomial coefficient. I w... |
No. Take $f(n)=g(n)=2^n$ for a counterexample. |
I didn't believe it, so I dusted off my rusty combinatorics skills and tried to figure it out. Here's what I have so far:
From the online ordering site I got the choices
1. crust (4 types, choose 1)
2. size (4 types, choose 1) some crusts are limited to a certain size - not accounting for that, but would like... |
Ok, A bit more detailed answer than in the comments.
Choosing $k$ out of $n$ is done by ${n \choose k} = \frac{n!}{k!(n-k)!}$. So for things like the size of the pizza, where you have 4 options (and you need to choose one, coz pizza cannot be both medium and extra-large at the same times) you have only $4$ options. ... |
The complexity class $\newcommand{\sharpp}{\mathsf{\#P}}\sharpp$ is defined as
$\qquad \displaystyle \sharpp = \{f \mid \exists \text{ polynomial-time NTM } M\ \forall x.\, f(x) = \#\operatorname{accept}_{M}(x)\}$.
It is known that $\sharpp$ is closed under addition, multiplication and binomial coefficient. I w... |
Is #P closed under exponentiation? modulo? |
null |
null |
I didn't believe it, so I dusted off my rusty combinatorics skills and tried to figure it out. Here's what I have so far:
From the online ordering site I got the choices
1. crust (4 types, choose 1)
2. size (4 types, choose 1) some crusts are limited to a certain size - not accounting for that, but would like... |
|reference-request|logic|formal-methods|sat-solvers|software-verification| |
|reference-request|logic|proof-assistants| |
|computability|undecidability| |
|logic|proof-techniques|books| |
null |
The more advanced an algorithm is, the heavier the required math will be. The field of (designing and analyzing) algorithms is a mathematical field. The algorithms are based on mathematical theorems and concepts, you cannot understand an algorithm without understanding the mathematical bases of the algorithm.
If you... |
null |
I'm trying to implement the Pastry Distributed Hash Table, but some things are escaping my understanding. I was hoping someone could clarify.
**Disclaimer**: I'm not a computer science student. I've taken precisely two computer science courses in my life, and neither dealt with anything remotely complex. I've worked... |
|algorithms|data-structures|distributed-systems|hash-tables| |
|algorithms|optimization|discrete-mathematics| |
A pizza commercial claims that you can combine their ingredients to 34 million different combinations. I didn't believe it, so I dusted off my rusty combinatorics skills and tried to figure it out. Here's what I have so far:
From the online ordering site I got the choices
1. crust (4 types, choose 1)
2. size ... |
Pizza commercial claim of 34 million combinations |
|combinatorics|discrete-mathematics| |
Ok, A bit more detailed answer than in the comments.
Choosing $k$ out of $n$ is done by ${n \choose k} = \frac{n!}{k!(n-k)!}$. So for things like the size of the pizza, where you have 4 options (and you need to choose one, coz pizza cannot be both medium and extra-large at the same times) you have only $4$ options. ... |
In [this answer][1] it is mentioned
> A regular language can be recognized by a finite automaton. A context-free language requires a stack, and **a context sensitive language requires two stacks (which is equivalent to saying it requires a full Turing machine)**.
I wanted to know regarding the truth of the bold p... |
null |
Ok, A bit more detailed answer than in the comments.
Choosing $k$ out of $n$ is done by ${n \choose k} = \frac{n!}{k!(n-k)!}$. So for things like the size of the pizza, where you have 4 options (and you need to choose one, coz pizza cannot be both medium and extra-large at the same times) you have only $4$ options. ... |
null |
A pizza commercial claims that you can combine their ingredients to 34 million different combinations. I didn't believe it, so I dusted off my rusty combinatorics skills and tried to figure it out. Here's what I have so far:
From the online ordering site I got the choices
1. crust (4 types, choose 1)
2. size ... |
null |
This is a basic question... but I'm thinking that O(M+N) is the same as O(max(M,N)), since the larger term should dominate as we go to infinity? Also, that would be different from O(min(M,N)), is that right? |
What is the meaning of O(M+N)? |
|time-complexity| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.