instruction stringlengths 0 29.8k ⌀ |
|---|
|artificial-intelligence|randomized-algorithms| |
The key thing to keep in mind here is that the equals sign in $f = O(g)$ does not behave as an equals sign usually would. The reason is that $O(g)$ is not actually a function but a **set** of functions. For example, you can think of $O(n^2)$ as being a set which, among many other functions, contains the functions $n$, ... |
We are given a labelled directed graph, where both vertices (or states) and edges (or transitions) have labels. Informally, two states are bisimilar when they have the same label and they can simulate each other's transitions. On the states the two states evolve to, the same again is true.
More formally, a binary re... |
How to quickly find a few bisimulations on a given labelled digraph? |
|algorithms|graphs|process-algebras| |
You can always return the bisimulation $∅$ in constant time.
You are right about the fact that in order to return $R$, you will have at least some sanity checks.
For example you could think that returning all bisimulations of the form $\{(p,q)\}$ when $p$ and $q$ have the same label and such that $p\not→$ and $q\... |
null |
There are $N$ number of people and $X$ amount of objects with different values. Each person will choose an object and will obtain that objects value. If multiple people choose the same object then the value of the object is shared among the people. For example, If there are 2 objects and 3 people, one of the objects wi... |
null |
null |
One simple way, better than random choice, is to use modification of one step [ExpectiMax][1]. Each round you will give each Objects Value some new estimated value V.
V= $\frac{Object Value}{ ( 1+ \sum\limits_{i=1}^n Pi )}$
where **Pi = probability that person i will chose this Object**
And every round you wi... |
One simple way, better than random choice, is to use modification of one step [ExpectiMax][1]. Each round you will give each Objects Value some new estimated value V(obj).
V(obj)= $\frac{ObjectValue(obj)}{ ( 1+ \sum\limits_{i=1}^n P_{i}(obj) )}$
where **$ P_{i}(obj)$ = probability that person i will chose Object... |
There are $N$ number of people and $X$ amount of objects with different values. Each person will choose an object and will obtain that objects value. If multiple people choose the same object then the value of the object is shared among the people. For example, If there are 2 objects and 3 people, one of the objects wi... |
First of all, I don't think there is any point in considering rounds, since each round is independent. So if the behavior of the players is not affected by the outcome of the previous rounds, they would play every round as a new round. You probably assume that there is an influence, but then this should be modeled.
... |
null |
I need to build a graph of order N such that each vertex has degree at least k and the graph has the smallest diameter. |
null |
I need to build a graph with $N$ vertices such that each vertex has degree at least $k$ and the graph has the smallest diameter. What algorithm can I use?
|
The question posed was:
given the following bit pattern:
10101000 0111
where the first 8 bits are a mantissa and the last 4 bits the exponent
what does the binary pattern represent in denary and show your working
OK I got the right answer! but the wrong or alternative working. Here is my working:
1)... |
binary float to denary problems |
|binary-arithmetic| |
I'd really like your help with proving the following:
prove that if $NTime(n^{100}) \subseteq DTime(n^{1000})$ then $P=NP$,
where $NTime(n^{100})$ is the class of all languages which can be decided by non deterministic Turing machine in polynomial time of $O(n^{100})$ and $DTime(n^{1000})$ is the class of all l... |
if $NTime(n^{100}) \subseteq DTime(n^{1000})$ then $P=NP$ |
|time-complexity|complexity-classes| |
null |
I'm having difficulty with the following question:
> Given a bit pattern with mantissa $10110000$ and exponent $0111$, what
> does the bit pattern represent in denary (i.e decimal / base 10)?
I got the right answer(!) but the wrong (or alternative) work:
1. Convert the exponent to denary: $0111$ is $7$
3. ... |
Floating-Point Binary to Decimal |
null |
null |
this is a near trivial consequence of the definition of NP completeness. if any language in NP is solvable in P time (which is asserted by the premise), then they all are. another way to look at this is to look at [Cooks theorem for NP completeness](http://en.wikipedia.org/wiki/Cook%E2%80%93Levin_theorem) that reduces ... |
The first loop has $y$ iterations, each iteration takes constant time ($O(1)$), so all together we have $O(y)$. The second loop has $ld(y)$ iterations of constant time, giving a complexity of $O(ld(y))$. Both loops together we have: $O(y + ld(y)) = O(y)$ because $y$ dominates $ld(y)$. |
given a `max heap`
` heap extract max`
the basic version takes `2lgn` steps
how can I make it in `lgn + lg(lgn)`
and how in `lgn+ lg(lg(lgn))`
this question is tricky me and my buddies gave up. |
Heap Extract MaX |
|algorithms| |
given a `max heap`
` heap extract max`
the basic version takes `2lgn` steps
how can I make it in `lgn + lg(lgn)`
and how in `lgn+ lg(lg(lgn))`
this question is tricky me and my buddies gave up.
I thought of putting -infinity on the heap root but not really sure what to do with it as it can go anywhere. |
Given a **max heap**, with **extract-max** operation.
The basic version takes $2 \log n$ steps.
How can I make it in $\log n + \log\log n$
and how in $\log n + \log\log\log n $?
I thought of putting -infinity on the heap root but not really sure what to do with it as it can go anywhere. |
|data-structures|heaps| |
Extract Max for a max-heap in $\log n + \log\log n$ |
|data-structures|runtime-analysis|amortized-analysis|heaps| |
I got the answer with a bit of reverse engineering.
1) 0111 is 7 in denary so the exponent is power(2,7)
2) convert 10101000 to a positive number using twos comp
3) you you get: 010110000 which is 1/2 + 1/ 8 + 1/16 using the powers of 2 after the radix point
4) this is 11/16 but we no it is negative from s... |
I'd really like your help with proving the following:
prove that if $\mathrm{NTime}(n^{100}) \subseteq \mathrm{DTime}(n^{1000})$ then $P=NP$,
where $\mathrm{NTime}(n^{100})$ is the class of all languages which can be decided by non deterministic Turing machine in polynomial time of $O(n^{100})$ and $\mathrm{DTime... |
if $\mathrm{NTime}(n^{100}) \subseteq \mathrm{DTime}(n^{1000})$ then $P=NP$ |
|time-complexity|complexity-classes|p-vs-np| |
null |
I would like to ask you some clarification on the following question:
know that ${\sf NP}$ is a subset of ${\sf IP}$
and also ${\sf coNP}$ it is a subset of ${\sf IP}$.
So ${\sf IP}$ is a biggest class, but how much it is big?
May i say that ${\sf PSPACE}$ is a subset of ${\sf IP}$? or that they may intersect?
... |
|complexity-theory|time-complexity|space-complexity|complexity-classes|interactive-proof-systems| |
Relation between interactive proof systems (IP), NP, coNP, PSPACE |
A book I am reading demonstrates how $5n^3 + 2n^2 + 22n + 6 = O(n^3)$, which I believe is true. After all, there exists a value $c$ for which $cn^3$ is always greater than $5n^3 + 2n^2 + 22n + 6$ for all $n$ greater than or equal to some value $n_0$.
However, the book then casually notes that $c = 5$ and $n_0 = 10$.... |
Why is $c$ 5 and $n_0$ 10? |
|time-complexity| |
null |
Here are some of the heuristics I use when playing online on XBOX live against bots, but the game is so much better with human players, bots are boring and predictable.
1. Obviously, what are you hold cards. Rockets to 7-2 off suite. There are many poker tables that give you the odds for the hold cards.
2. How ma... |
Hopefully this is the right section. I need to prove that 2^(log(n)^.5) is O(n^a). From the basic principle of Big-O notation, I know I need to find two numbers c and N so that f(n) <= c*g(n) for all values of n >= N. In this case, f(n) is 2^(log(n)^.5), and g(n) is n^a.
The first problem in the set had me prove tha... |
Prove that 2^(log(n)^.5) is O(n^a) |
|complexity-theory|time-complexity| |
For $n \geq 2$, $f(n) = 2^{\sqrt{\log n}} = 2^{\frac{\log n}{\sqrt{\log n}}} = \exp(\frac{\log n}{\sqrt{\log n}} \times \log 2) = n^{\frac{1}{\sqrt{\log n}}}$. Can you prove that if $h(n) = O(k(n))$ then $n^{h(n)} = O(n^{k(n)})$ ? |
$n^a = \exp(a \ln n) = \exp(a \ln n \frac{\ln 2}{\ln 2}) = 2^{\frac{a \ln n}{\ln 2}}$. Can you prove that if $h(n) = O(k(n))$ then $2^{h(n)} = O(2^{k(n)})$ ? |
I'm currently working on this question as part of some homework, it has me stumped.
http://i.imgur.com/39DTQ.png
I'm familiar with FSA, I know how they work and I've read everything I can find on google, but nothing's helped me come any closer to a solution.
If I don't know the lenth of the input string, or I'... |
FSA for recognising consecutive characters |
|formal-languages|finite-automata| |
Hopefully this is the right section. I need to prove that $2^{(log(n)^{1/2})}$ is $O(n^a)$. From the basic principle of Big-O notation, I know I need to find two numbers $c$ and $N$ so that $f(n) \le c\cdot g(n)$ for all values of $n \ge N$. In this case, $f(n)$ is $2^{(log(n)^{1/2})}$, and $g(n)$ is $n^a$.
The firs... |
|asymptotics|landau-notation| |
Questions about asymptotic notations such as Big-O, Omega, etc. |
It holds that $\log x^y=y\log x$. Hence we have
$$2^{\log n^{1/2}}=2^{1/2 \log n}=(2^{\log n})^{1/2}=n^{1/2}=O(n^{1/2}).$$
So this is mostly about computing with logarithms, and not so much about the big-O notation. |
Finding $c$ and $n_0$ for a big-O bound |
|asymptotics|landau-notation| |
The FSA should have three states:
* $q_a$ represents: **last character was not a `b`, and no `bb` yet**
* $q_b$ represents: **last character was a `b`, and no `bb` yet**
* $q_{bb}$ represents: **there was already a `bb`**
Clearly, you start with $q_a$ and you accept in $q_a$ and $q_b$. Now try to figure... |
I'm currently working on this question as part of some homework, it has me stumped.
![FSA Question][1]
I'm familiar with finite state automata (FSA), I know how they work and I've read everything I can find on Google, but nothing's helped me come any closer to a solution.
If I don't know the lenth of the input... |
Finite State Automata for recognising consecutive characters |
null |
I'm currently working on this question as part of some homework, it has me stumped.
![FSA Question][1]
I'm familiar with finite state automata (FSA), I know how they work and I've read everything I can find on Google, but nothing's helped me come any closer to a solution.
If I don't know the length of the inpu... |
Prove that $2^{(log(n)^{1/2})}$ is $O(n^a)$ |
null |
The worst case for the number of `function` calls is (as you already observed)
$$\sum_{i=1}^{2N}\sum_{j=1}^{i/2} 2 =\sum_{i=1}^{2N} i = \frac{2N(2N+1)}{2}=2N^2+N,$$
by Gauß' summation formula.
|
I have some difficulties performing the worst case analysis on this algorithm.
The outermost loop is executed $2N$ times.
The while loop, in the worst case, will increase by $2$ each time, so it performs $i/2$ basic operations ($*2$ because double call)
for (i=1; i<=2*N; i++) {
j = 0;
... |
Runtime analysis of a nested loop |
|algorithms|algorithm-analysis|runtime-analysis|loops| |
I have been told than $n^{1000001} = O(1.000001^n)$. If that's the case, there must be some value $n$ at which $1.000001^n$ exceeds $n^{1000001}$.
However, when I consult Wolfram Alpha, I get a negative value for when that occurs.
http://www.wolframalpha.com/input/?i=1.000001%5Ex+%3D+x%5E1000001
Why is that? Sho... |
When does $1.00001^n$ exceed $n^100001$? |
|time-complexity| |
What you have been told is true. However the number where both function meet is veeeerrrry huge. There is also a second intersection point that you got with Wolfram. You can play around with smaller numbers of this pattern to get a feeling how large this value gets.
To see that the statement is true, it is the easie... |
When does $1.00001^n$ exceed $n^{100001}$? |
|asymptotics|landau-notation| |
$f(n)$ = $O(g(n))$ implies that for *all* $n > N_0$, $N_0 > 0$, the relation $f(n) \leq c * g(n)$ holds for some $c > 0$.
Following this definition, we have:
$n^{1000001} \leq c * (1.000001)^n$
$1000001 * log(n) \leq log(c) + n * log(1.000001)$
Checking for $1000001 * log(n) = n * log(1.000001)$ on [Wolfram][... |
$f(n)$ = $O(g(n))$ implies that for *all* $n > N_0$, $N_0 > 0$, the relation $f(n) \leq c * g(n)$ holds for some $c > 0$.
Following this definition, we have:
$n^{1000001} \leq c * (1.000001)^n$
$1000001 * log(n) \leq log(c) + n * log(1.000001)$
Checking for $1000001 * log(n) = n * log(1.000001)$ on [Wolfram][... |
Given a **max heap**, with **extract-max** operation.
The basic version takes $2 \log n$ steps.
How can I make it in $\log n + \log\log n$
and how in $\log n + \log\log\log n $?
I thought of putting -infinity on the heap root but not really sure what to do with it as it can go anywhere.
EDIT: steps are cons... |
What you have been told is true. However the number where both function meet is huge (see Paresh' answer). There is also a second intersection point that you got with Wolfram. You can play around with smaller numbers of this pattern to get a feeling how large this value gets.
To see that the statement is true, it i... |
null |
The first loop has $y$ iterations, each iteration takes constant time ($O(1)$), so all together we have $O(y)$. The second loop has $\log_2(y)$ iterations of constant time, giving a complexity of $O(\log_2(y))$. Both loops together we have: $O(y + \log_2(y)) = O(y)$ because $y$ dominates $\log_2(y)$. |
null |
Here are some of the heuristics I use when playing online on XBOX live against bots, but the game is so much better with human players, bots are boring and predictable.
1. Obviously, what are you hold cards. Rockets to 7-2 off suite. There are many poker tables that give you the odds for the hold cards.
2. How ma... |
Elmasry et al. discuss reducing the number of comparisons for extract-max to $\log n + o(\log n)$ in ["A Framework for Speeding Up Priority-Queue Operations"](http://www.cphstl.dk/Report/Layered-heaps/cphstl-report-2004-3.pdf). See also Elmasri's "Layered Heaps", Edelkamp et al.'s "Two Constant-Factor-Optimal Realizati... |
I'm trying to understand a formalization of the shortest path algorithm to a linear programming problem:
For a graph $G=(E,V)$, we defined $F(v)=\{e \in E| t(e)=v \}$ and $B(v)=\{ e \in E| h(e)=v\}$ where $t(e)$ is a tail of a node, and $h(e)$ is a head of a node.
Also the solutions for the conditions for the l... |
formalization of the shortest path algorithm to a linear program |
|shortest-path|linear-programming| |
I'm trying to understand a formalization of the shortest path algorithm to a linear programming problem:
For a graph $G=(E,V)$, we defined $F(v)=\{e \in E| t(e)=v \}$ and $B(v)=\{ e \in E| h(e)=v\}$ where $t(e)$ is a tail of a node, and $h(e)$ is a head of a node.
Also the solutions for the conditions for the l... |
I try to understand if someone can apply a **NTM** to solve **coNP** language.
From the definition we know that:
**NP** - set of languages that can be solved by NTM in polynomial time.
**coNP** - set of all languages that are complement to NP language.
as with P versus NP question, we have NP versus coNP qu... |
coNP and limitation of NDTM |
|complexity-theory|np-complete|complexity-classes| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.