instruction
stringlengths
0
29.8k
⌀
null
Yes, such cellular automata have been studied. However, you're unlikely to find much about them using terms like "Eisenstein integers", since the convention in the field is to describe cellular automata on regular lattice using the lattice symmetry (e.g. hexagonal / rectangular / triangular for 2D lattices) and the [n...
Suppose we are appending elements to the tail of the list. Suppose also that the rightmost finger has index $f$. Now, the distance between $f$ and the second rightmost finger $f - 1$ (which should be the largest since we are comparing two rightmost fingers (the distance between adjacent fingers grows as we scan the fin...
Start with *the* context-free language for beginners $\{ a^nb^n \mid n\ge 0\}$. > $S\to aSb\mid \varepsilon$ Instead end with the symbol $c$ in the middle. > $S\to aSb\mid c$ Now sprinkle the left and right parts with free $b,c$ and free $a,c$ respectively. > $S\to aSb\mid c \mid bS\mid cS\mid Sa\mid Sc ...
Notice that it's preferable in that case (and in general too) to use the conclusion of myhill-nerode theorem which is: if there are infinite strings such that every two strings $w,s$ satisfies $w\not\equiv_Ls$ then the language $L$ isn't regular. So in your case, you can take the strings $w_i=a^i2$ and the string $z...
null
IMO both you and the teacher read in a contrived way. I would say "I go to town implies that I have time and I have time implies that I go to town". Note that as this is formal logics, no causation should be considered. (I am not going to town *because* I have time nor conversely; it is just two events that will sim...
null
Yes. DSATUR produces an optimal coloring for interval graphs. My idea is as follows (Please identify any potential issues). We know that **a)** In DSATUR, once a new vertex has been colored then we should determine which of the remaining uncolored vertices has the highest number of colors in its neighborhood to color t...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one item from each set. - Zero-weighted items...
Variant of the Knapsack Problem 0-1 - One item from each set and zero-weighted items
|algorithms|knapsack-problems|optimal-strategy|
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one item from each set. - Zero-weighted items...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one item from each set. - Zero-weighted items...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one item from each set. - Zero-weighted items...
About the "computationally expensive": They calculated the number of ways to put eight queens onto 8 fields of an 8x8 chessboard, ignoring the identity of the queens. But anybody in their right mind trying to place 8 queens in a way that they don't attack each other wouldn't try to place two queens into the same ro...
null
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one item from each set. - Zero-weighted items...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one item from each set. - Zero-weighted items...
The IEEE 754 standard for floating point numbers defines a flag that is set when a result from floating point calculation isn't exact, i.e. has to be rounded. What algorithms are there that utilize that information?
What are the use cases for the IEEE 754 inexact flat?
|floating-point|numerical-algorithms|
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one item from each set. - Zero-weighted items...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one item from each set. - Zero-weighted items...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one item from each set. - Zero-weighted items...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it, mostly because of the 0-weighted items. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one ite...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it, mostly because of the 0-weighted items. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one ite...
I understand the basics of the 0-1 problem and its solution. I have a variant of it that I'm trying to solve in a decent way and I'm struggling on it, mostly because of the 0-weighted items. These are the rules: - I have k finite sets of items. Each item has a weight and a value. - I must take exactly one ite...
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\ log_2{n} + 3 = \mathcal{O}(n\ log(n)$ ...
Big O notation - Help for solving an equation
|complexity-theory|
null
Big O - Help for solving an equation
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\ log_2{n} + 3 = \mathcal{O}(n\ log(n))$ ...
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\ log_2(n) + 3 = \mathcal{O}(n\ log(n))$ ...
This started with me trying to make a regex to accept Bitcoin addresses. However, I couldn't do it. That led me to think: "is the set of all possible Bitcoin addresses even a regular language"? For simplicity, consider only "legacy" P2PKH Bitcoin addresses: a valid address consist of the character "1" followed by 25...
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\ log_2(n) + 3 = \mathcal{O}(n\ log(n))$ ...
null
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\ log_2(n) + 3 = \mathcal{O}(n\ log(n))$ ...
null
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\ log_2(n) + 3 = \mathcal{O}(n\ log(n))$ ...
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\ log_2(n) + 3 = \mathcal{O}(n\ log(n))$ ...
I want to prove that, $$ \log n! \in O(n \log n) \land \log n! \in \Omega(n \log n)$$ The straightforward approach is to apply stirling's formula but I am looking for a different path to follow. Can somebody please guide me towards it?
Big O notation problem
|big-o-notation|
A nice method is : $$ \begin{align*} \log n! & = \log \prod_{\psi=1}^n \psi \\ & = \sum_{\psi=1}^n \log \psi \\ & \sim \int_1^n \log \psi \; \mathrm d \psi \\ & = \psi \log \psi - \psi \Biggr|_{1}^{n} \\ & = n \log n - (n - 1) \end{align*} $$ If we had used stirling's approximation instead, we would have re...
Note that $\log n! = \sum_{k = 1}^n \log k$. Then $$\sum_{k = 1}^n \log k = \int_1^{n + 1} \log \lfloor x \rfloor dx \le \int_1^{n + 1} \log x dx = (n + 1) \log (n + 1) - n,$$ and $$\sum_{k = 1}^n \log k = \int_0^{n} \log \lceil x \rceil dx \ge \int_0^{n} \log x dx = n \log n - n .$$
Same can be possible in steps. For $n>1$: $$4\sqrt{n}<4n\log n$$ $$3< 3n\log n$$ summing up we have $$\sqrt{n}+2n\log n+3<9n\log n$$ for $n>1$. As to "right" bound, then such doesn't exist - any bounds are right, if/when they satisfy definition.
If weights aren't too large, use the standard pseudo-polynomial-time algorithm (using dynamic programming) for the knapsack problem. It is easy to adjust to this setting. See https://en.wikipedia.org/wiki/Knapsack_problem#0-1_knapsack_problem. If weights can be large, use integer linear programming, and apply an o...
#include <stdint.h> typedef void (*ptr)(); void P(ptr x) { if (H(x, x)) HERE: goto HERE; return; } int main() { Output("Input_Halts = ", H(P, P)); } _P() [00001352](01) 55 push ebp [00001353](02) 8bec mov ebp,e...
#include <stdint.h> typedef void (*ptr)(); void P(ptr x) { if (H(x, x)) HERE: goto HERE; return; } int main() { Output("Input_Halts = ", H(P, P)); } _P() [00001352](01) 55 push ebp [00001353](02) 8bec mov ebp,e...
I think this problem is more similar to matching problem than knapsack problem. In other words, you can introduce a bipartite graph with two sets $S$ of objects (A, B, C, ...) and $T$ of weights ($0, 1, 2 ,...$) and a weighted arc between each object i to each weight j; e.g. weight($v_{A5})=26$ in your example. T...
null
For complete rigor, $$x-1<\lfloor x\rfloor\le x$$ so that by monotonicity of the logartihm $$\log(x-1)<\log\lfloor x\rfloor\le \log x.$$ Hence by integration from $2$ to $n+1$, $$\int_1^n\log x\,dx<\sum_{k=2}^n\log k\le\int_2^{n+1}\log x\,dx$$ and $$n\log n-n+1<\log n!\le(n+1)\log(n+1)-n+1-2\log2.$...
For complete rigor, $$x-1\le\lfloor x\rfloor\le x$$ so that by monotonicity of the logartihm $$\log(x-1)\le\log\lfloor x\rfloor\le \log x.$$ Hence by integration from $2$ to $n+1$, $$\int_1^n\log x\,dx\le\sum_{k=2}^n\log k\le\int_2^{n+1}\log x\,dx$$ and $$n\log n-n+1\le\log n!\le(n+1)\log(n+1)-n+1-...
What are the use cases for the IEEE 754 inexact flag?
Same can be possible in steps. For $a>1$: $$4\sqrt{n}<4n\log_a n$$ $$3< 3n\log_a n$$ where $n>a$. Summing up we have $$\sqrt{n}+2n\log_a n+3<9n\log_a n$$ for $a>1$. As to "right" bound, then such doesn't exist - any bounds are right, if/when they satisfy definition.
Problem ------- [You][1] are given two integer arrays `nums` and `multipliers` of size `n` and `m` respectively, where `n≥m`. The arrays are **1-indexed.** You begin with a score of `0`. You want to perform **exactly** `m` operations. On the `iᵗʰ` operation **(1-indexed)**, you will: - Choose one integer `x` from...
#include <stdint.h> typedef void (*ptr)(); void P(ptr x) { if (H(x, x)) HERE: goto HERE; return; } int main() { Output("Input_Halts = ", H(P, P)); } _P() [00001352](01) 55 push ebp [00001353](02) 8bec mov ebp,e...
Given the ambiguous CFG : $ S \to 01S1\mid SS\mid\epsilon $ I came up with the following CFG which I think is unambiguous: $S \to 01X \mid 011X$ $X \to 01X1 \mid \epsilon$ Is my CFG unambiguous and does it represent the same language?
Convert ambiguous grammar $S \to 01S1\mid SS\mid\epsilon$ to unambiguous grammar
|formal-languages|context-free|formal-grammars|ambiguity|
Let $D$ be the given grammar, $S \mapsto01S1\mid SS\mid\epsilon$. Then each word $w$ generated by $D$ is a mixture of equal number of $01$'s and $1$'s such that in any prefix of $w$ there are at least as many $1$'s as 0's but at most twice as many $1$'s as $0$'s. Let $H$ be your grammar, $S \mapsto01X\mid011X$ ...
null
Because a halt decider must compute the mapping from its inputs to an accept or reject state on the basis of the actual behavior of its actual inputs, when H is a simulating halt decider H(P,P) would return 0 on the basis that its input specifies infinitely nested simulation that never reaches its "ret" instruction. ...
null
If we divide the inequation by $n\lg n$, we get $$\frac{4}{\sqrt n\lg n}+\frac{3}{n\lg n}+2\le c.$$ By a quick study of the denominators, we can see that the fractions are monotonically decreasing, say for $n\ge n_0=2$. Hence any $c$ such that $$\frac{4}{\sqrt 2\lg 2}+\frac{3}{2\lg 2}+2\le c$$ will do. [![...
If we divide the inequation by $n\lg n$, we get $$\frac{4}{\sqrt n\lg n}+\frac{3}{n\lg n}+2\le c.$$ By a quick study of the denominators, we can see that the fractions are monotonically decreasing, say for $n\ge n_0=2$ (they are as of $x>1$). Hence any $c$ such that $$\frac{4}{\sqrt 2\lg 2}+\frac{3}{2\lg 2}+2...
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\ log_2(n) + 3 = \mathcal{O}(n\ log(n))$ ...
If we divide the inequation by $n\lg n$, we get $$\frac{4}{\sqrt n\lg n}+\frac{3}{n\lg n}+2\le c.$$ By a quick study of the denominators, we can see that the fractions are monotonically decreasing, say for $n\ge n_0=2$ (they are as of $x>1$). Hence any $c$ such that $$\frac{4}{\sqrt 2\lg 2}+\frac{3}{2\lg 2}+2...
relatively new to Computer Vision. Lets say for example, I have a sequence of images of a car driving away from a static camera into the horizon, and I want to use this image set for some bog standard computer vision experimentation (e.g to train a CNN to recognize a car). I label the car in each frame with a recta...
Tolerance of object size variation for computer vision
|computer-vision|
null
I'm working my way through parts of Russell and Norvig's AIMA book for a class, and there's something I've never quite managed to wrap my head around. Chapters 3 and 4 contrast 'search' methods with 'local search' optimization methods, suggesting to me that there is some kind of fundamental difference between the two. ...
Rigorous distinction between search and optimization
|artificial-intelligence|graph-traversal|search-trees|
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\ log_2(n) + 3 = \mathcal{O}(n\ log(n))$ ...
Yes, you can. For instance: with language $L = \{a^nb^n \mid n\ge0\}:$ and mapping $h(a)=a$ , $h(b)=a$ (which I think is what you meant to write), $h(L) = (aa)^*$. What is more: [*every* context-free language on a single-symbol alphabet is regular][1], so a mapping that maps every symbol to the same symbol alway...
If I have realized the problem, I think this problem is more similar to matching problem than knapsack problem. In other words, you can introduce a bipartite graph with two sets $S$ of objects (A, B, C, ...) and $T$ of weights ($0, 1, 2 ,...$) and a weighted arc between each object i to each weight j; e.g. weight of...
Can you help me find the theta complexity for lg(n)?
I need to sort out the theta complexity for lg(n)
|time-complexity|recurrence-relation|
Can you help me find the theta complexity for lg(n^(1/2))?
I need to sort out the theta complexity for lg(n^(1/2))
$log(n^{\frac{1}{2}}) = \frac{1}{2}log(n) = \theta(log(n))$. More formally, there exists constants $c1$,$c2$ such that: $c1⋅\frac{1}{2}log(n)≤log(n)≤c2⋅\frac{1}{2}log(n)$
A valid answer is $$\lg(\sqrt n)=\Theta(\lg(\sqrt n)).$$ This is true as of $n=1$ with constants $1$. Another valid answer is $$\lg(\sqrt n)=\Theta\left(\sum_{k=1}^n\frac1k\right).$$
A valid answer is $$\lg(\sqrt n)=\Theta(\lg(\sqrt n)).$$ This is true as of $n=1$ with constants $1$. Another valid answer is $$\lg(\sqrt n)=\Theta\left(\sum_{k=1}^n\frac1k\right).$$ (Holds as of $n=2$ with constants $0.2$ and $1$.)
I want to prove that, $$ \log n! \in O(n \log n) \land \log n! \in \Omega(n \log n)$$ The straightforward approach is to apply Stirling's formula but I am looking for a different path to follow. Can somebody please guide me towards it?
Prove big O notation for $\log(n!)$ without applying Stirling's formula
|big-o-notation|factorial|
I'm following an online course about Complexity and I'm learning a lot of stuff. I came across a particular exercise and I'm unable to find it out by myself, this is why I'm writing this message here. The exercise is to prove the following is true: $4\ \sqrt{n} + 2\ n\log_2(n) + 3 = \mathcal{O}(n\log(n))$ S...
Big O notation: how to prove $4\sqrt{n} + 2n\log_2(n) + 3 = \mathcal{O}(n\log(n))$?
|big-o-notation|
No,by your defined substitution CFLs remains CFLs. For example, $\{a^nb^n \mid n\ge0\} = \{\epsilon,ab, aabb, aaabbb,.......\}.$ After substitution by $h(a) = a$ and $h(b) =b$,$h(\epsilon) = \epsilon$ then the language L becomes remains same, which is CFL. But when every symbol converges to single image then your...
Let $L$ be a regular language. Define: $half(L)=\{x|xy\in L,|x|=|y|\}$ Prove that $half(L)$ is regular as well. I have seen a hard proof by using the DFA A of L, building a NFA B (such that every transition from the stating state to the next one with the word $x$ will exist iff $\exists y$ s.t $|x|=|y| , \delt...
How to prove that $half(L)=\{x|xy\in L,|x|=|y|\}$ is Regular Language
|formal-languages|regular-languages|automata|finite-automata|context-free|
I guess this question [Prove half(L) is regular][1] is the same. There are several ways to prove a language is regular: 1. By building DFA, NFA, or Regular Expression (which is the case in your question). 2. Using the Myhill-Nerode theorem. However, in general, it's used only to prove a language isn't regular. ...
Your labels should be based on what you want the model to output when used in deployment. If you use this in deployment, is it important to produce a 3x1 bounding box? If it is, you'd better include those images and label those cars. If it is important to not produce a 3x1 bounding box, you'd better include those im...