instruction stringlengths 0 29.8k ⌀ |
|---|
|data-structures|computational-geometry|search-algorithms|nearest-neighbour| |
I am trying to find a lightweight data structure to find the nearest neighbor mesh (a mesh being a collection of non-unique triangles) for a given point. I have seen nearest neighbor problems for points and triangles, but never meshes as a whole collective.
So, in essence given a point P find the nearest mesh M to ... |
I am trying to find a lightweight data structure to find the nearest neighbor mesh (a mesh being a collection of non-unique triangles) for a given point. I have seen nearest neighbor problems for points and triangles, but never meshes as a whole collective.
So, in essence given a point P find the nearest mesh M to ... |
null |
This is essentially the criterion used by type systems to avoid divergence. Take, for instance, the simply typed lambda calculus. In order for $f\ x$ to be well typed, we must have:
$$f : T → U \\ x : T$$
In order for $f\ f$ to be well typed, it would have to be the case that:
$$T = T → U$$
But types are re... |
I am trying to find a lightweight data structure to find the nearest neighbor mesh (a mesh being a collection of non-unique triangles) for a given point in R3 (3D Euclidean space). I have seen nearest neighbor problems for points and triangles, but never meshes as a whole collective.
So, in essence given a point P ... |
It suffices to store all of the triangles from all of the meshes in a nearest-neighbor data structure for triangles. Then, given a point P, find the nearest triangle, check which mesh that triangle is a part of, and that will be the nearest mesh. |
Presumably you are after a susbstitution like$$\sqrt{n+m}\,n^3\le f(n)\,g(m),$$ or equivalently
$$n+m\le p(n)\,q(m).$$
If you freeze $m$, then $p(n)=\Omega(n)$ must hold (and similarly $q(m)=\Omega(m)$). So I see no better solution than
$$\sqrt{n+m}\,n^3\le n^{7/2}m^{1/2}.$$ |
First:
If we use your definition of a CFG, they still can be non-planar. Consider the following (silly) piece of code:
void D(){}
void E(){}
void F(){}
void A(x){
if(x == 0) D();
else if(x == 1) E();
else F();
}
void B(x){
if(x == 0) D();
else i... |
Presumably you are after a substitution like$$\sqrt{n+m}\,n^3\le f(n)\,g(m),$$ or equivalently
$$n+m\le p(n)\,q(m).$$
If you freeze $m$, then $p(n)=\Omega(n)$ must hold (and similarly $q(m)=\Omega(m)$). So I see no better solution than
$$\sqrt{n+m}\,n^3\le n^{7/2}m^{1/2}.$$ |
If you multiply $m$ by $10$, the magnitude of the term varies by a factor
$$\sqrt{\frac{n+10m}{n+m}}=\sqrt{\frac{\frac nm+10}{\frac nm+1}}.$$
That factor stays in range $\left(1,\sqrt{10}\right)$ and varies relatively little as a function of $\frac nm$.
If you multiply $n$ by $10$, the magnitude varies by $100... |
In my experience, the duality of Petri nets is a great strength.
It forces us to specify the potential events or actions in a system (the transitions), as they may happen to individual items (the tokens), together with their preconditions and postconditions (the places). This forces us to think through what a step r... |
On calculating the convexity of an optimization problem, I am getting a term $O(\sqrt{n+m}(n)^3)$. Here both $m$ and $n$ are parameters. Is there any way I can simplify this term to write it as a product?<br/>
I know that if time complexity $T(n,m)=O(\sqrt{n+m}(n)^3)$, then $\exists C,M $ such that $\vert T(n,m) \vert... |
[Ogden's lemma][1] seems to work better here. Suppose $L$ is context-free and let $p$ be the lower limit. Choose $s = a^{p}b^{p+2}c^{p+1}$ and mark all the $a$'s (the first $p$ symbols of $s$). Then by Ogden's lemma we should be able to write $s = uvwxy$ such that:
1. $vx$ has at least one marked position: this mean... |
I would like to know whether a theory exists which generalizes boolean logic to floats.
Specifically, assume that instead of booleans 1 and 0, I have True/False *tendencies*, such as 0.9, where 0.1. Here, 1.0 would mean completely true, and 0.0 completely false.
Boolean logic:
0 && 1 # == 0
0 || 1 # ... |
Boolean Logic for Floats |
|logic|combinatorics|arithmetic| |
How do I represent DJNZ command of counting machine via commands of Universal Register Machine, those commands are CLR JNE INC and TR, via this commands i have to represent DJNZ command, any help would be great. |
DJNZ command in Universal Register Machine |
|turing-machines|computability|coding-theory|counting|shift-register| |
My question is generalizable to arrays of any type but I'll use strings to keep it short.
Let's say we two strings as input: "ABEF" and "CDE". Our quest is to
- merge their elements while keeping the relative order of the elements, and
- do not repeat elements.
The problem has multiple solutions, but I'm fine... |
Algorithm for merging arrays while keeping their order |
|algorithms|time-complexity|sorting| |
You can easily solve your problem by creating a directed graph $G=(V,E)$ in which $V$ is the set of all characters that appear in some input string and $E$ contains the edge $(u,v)$ if character $u$ is immediately followed by character $v$ in some string.
This graph has $O(n)$ edges where $n$ is the total length of ... |
I'm studying Turing machines and I came across the following definitions:
>NP is the set of problems that can be solved in polynomial time by a non-deterministic Turing machine.
and
>Let t(n) be a function, where t(n) ≥ n. Then
every t(n) time non-deterministic single-tape Turing
machine has an equivalent 2... |
Turing Machines time complexity with regard to the NP and P problem |
|complexity-theory|turing-machines|np| |
I recommend that you look up 'Fuzzy Logic'. |
You can easily solve your problem by creating a directed graph $G=(V,E)$ in which $V$ is the set of all characters that appear in some input string and $E$ contains the edge $(u,v)$ if character $u$ is immediately followed by character $v$ in some string.
This graph has $O(n)$ edges where $n$ is the total length of ... |
>What are the 'advantages' of a deterministic TM over the non-deterministic one?
The advantage of the deterministic TM is that deterministic Turing Machines represent the type of computation we are capable of, whether by hand, calculator or computer. The non-deterministic Turing Machine includes a power our intuitiv... |
> If this is wrong, can we always write a program whose CFG is planar without loss of function?
Yes, we can.
Suppose we have an arbitrary CFG $G$, which is a finite graph.
> It is known that any finite graph can be embedded into a three-dimensional space. - Wikipedia
Let's say for our CFG, we have a 3D e... |
So I'm doing an AI course that it talking about time complexities of different tree search algorithms. On this slide it talks about the time complexity of the algorithm, and I'm confused as to why we ignore the $d$ multipliers in the series for the Big-O time complexity of the algorithm
[![enter image description he... |
Would someone be able to explain why the Time Complexity here is O(b^d) instead of O(d(b^d))? |
|complexity-theory|time-complexity|search-trees|big-o-notation| |
So I'm doing an AI course that is talking about time complexities of different tree search algorithms. On this slide it talks about the time complexity of the algorithm, and I'm confused as to why we ignore the $d$ multipliers in the series for the Big-O time complexity of the algorithm
[![enter image description he... |
I've been learning about data speed and width and the rate of the bus where information is transmitted between components. But I can't see or understand how fast is the transmission.
For example, in theory, I've read about how PCI operates at 133MBps and 266mbps and such, however, I can't seem to comprehend how fas... |
Is there any video where I can see how different data rates impact daily activities? |
|computer-architecture| |
If $b, d$ goes to infinity, as all other sum factors are asymptotically less than $b^d$ (except the last one!), the mentioned time complexity function will be in $\Theta(b^d)$. Hence, this algorithm is also in $O(db^d)$, but a tighter bound is $O(b^d)$. |
null |
**This is incorrect -- it does not take into account that $|vwx|$ can have more than $p$ characters. I will try to salvage it in the coming days.**
[Ogden's lemma][1] seems to work better here. Suppose $L$ is context-free and let $p$ be the lower limit. Choose $s = a^{p}b^{p+2}c^{p+1}$ and mark all the $a$'s (the fi... |
Nondeterminstic RAM is like deterministic RAM with extra instruction “JMAYBE” which nondeterministically jump or continue when executed.
We can simulate nondeterministic RAM on nondeterministic TM , with only logarithmic overhead.
But i can not how can we use nondeterminism to reach such a efficient simulation.
|
Simulating nondeterministic RAM with nondeterminstic turing machine |
|complexity-theory|time-complexity|computation-models| |
Let x = $b^d$. The last term is x. The second to last is x * (2 / b). The third to last is $x * (3 / b^2)$, then $x * (4 / b^3)$ etc.
Let y = $x * (1 + 1 / b + 1 / b^2 + 1 / b^3 ...)$. That's a simple geometric series, easily to calculate. Now the sum is actually $y + y/b + y/b^2 + y/b^3 ...). Another simple geomet... |
Nondeterminstic RAM is like deterministic RAM with extra instruction “JMAYBE” which nondeterministically jump or continue when executed.
We can simulate nondeterministic RAM on nondeterministic TM , with only logarithmic overhead.
But how can we use nondeterminism to reach such a efficient simulation.
|
**Hint:**
$$s(d):=b^0+b^1+b^2+\cdots b^d=\frac{b^{d+1}-1}{b-1}$$
and by summation until $d+1$ and differentiation,
$$t(d):=0b^0+1b^1+2b^2+\cdots db^d=\frac{\partial}{\partial b}s(d+1)=\frac{d b^{d+1} - (1 + d) b^d +1}{(b-1)^2}.$$
The target expression is $(d+1)s(d)-t(d)$.
|
null |
Nondeterminstic RAM is like deterministic RAM with extra instruction “JMAYBE” which nondeterministically jump or continue when executed.
According to this paper:
[An $O(T \log T)$ reduction from RAM computations to satisfiability][1]
I guess that we can simulate nondeterministic RAM on nondeterministic TM , with only ... |
Nondeterminstic RAM is like deterministic RAM with extra instruction “JMAYBE” which nondeterministically jump or continue when executed.
According to this paper:
[An $O(T \log T)$ reduction from RAM computations to satisfiability][1]
I guess that we can simulate nondeterministic RAM on nondeterministic TM , with only ... |
**Intuitively :** Number of nodes in last level is more than sum of all nodes in Previous level.
- At Level-$\color\red0$, we have $1$ node. It can be written as $b^\color\red0$
- At Level-$\color\red1$, we have $b$ nodes. Can be written as $b^\color\red1$
- At Level-$\color\red2$, there will be $b^\color\red2$ node... |
Cloudflare famously uses a wall of lava lamps (https://en.wikipedia.org/wiki/Lavarand) to seed random number generators. But if you're going into the real world to seed your rng, why lava lamps? Why not roll 1000 D20's (say dice with 20 different colored faces) and call it a day? Is it just to look cool, or does the di... |
Why Lavarand (as opposed to other methods of generating random seeds)? |
|randomness|random-number-generator| |
null |
Cynical answer: Because lava lamps are pretty and the wall of lava lamps makes good marketing and it sounds impressive and conveys the impression that they are serious about security.
In practice, if all you care about is engineering, it suffices to seed a [cryptographic strength pseudorandom number generator](https... |
I understand that caches are the smallest and fastest memory that is integrated into the CPU. However, what I am confused about is the information that it holds. From what I know, the capabilities of cache are:
L1 cache - 64KB
L2 cache - 256KB
L3 cache - 4-12 MB
Ram - 4-74 GB
For example: If I open up a page o... |
What kind of data does L1, L2, L3 cache hold? |
|computer-architecture| |
null |
L1 cache: Every time you access any data, either it is in L1 cache already, or one cache line worth of data (often 32 or 64 byte) is read from the next level, and stored into L1 cache. If necessary, the data that was stored in that cache line is removed, and if it was modified, it is first written to the next level of ... |
this is my First post,I apologize for my ignorance.
The question is:
Could a programmer (human or Ai) with all the computing power and infinite time create a simulation of a world with our same laws of physics without errors of any kind (both software and hardware errors)?
Clarification:1) the simulation should... |
are computer errors inevitable? |
|optimization|artificial-intelligence|quantum-computing|simulation| |
Nondeterminstic RAM is like deterministic RAM with extra instruction “JMAYBE” which nondeterministically jump or continue when executed.
According to this paper:
[An $O(T \log T)$ reduction from RAM computations to satisfiability][1]
I guess that we can simulate nondeterministic RAM on nondeterministic TM , with only ... |
As the author of the article you linked writes [in a different article](https://web.eecs.umich.edu/~mjguz/uploads/Guzdial-Koli-longform.pdf) [**bold** emphasis mine]:
> A task-specific programming language (TSPL) **is a domain-specific programming language** (in programming languages terms) **designed for a particul... |
null |
The language $\mathrm{half}(L)=\{x\mid xy\in L,|x|=|y|\}$ can be quite complicated, compared to the original language $L$. I am afraid that **there is no simple construction and we have to keep track of the behaviour of the automaton both forward and backward**, which is the product automaton you are referring to.
L... |
Here is your hint. Imagine that we augment $P$ to record a log of all the random-access reads and writes $P$ does to memory (i.e., for each read, record the address and the value that was read; for each write, record the address and the value that was written), in the order they were done. At the end of the computati... |
null |
I am currently stuck on this problem, it is from a very highly competitive contest and so it is highly difficult as well. here is the statement:
**There are 2 lists of integers with the same length. Pick an integer from each list and calculate the absolute value of their sum. Return the minimum value for the value.*... |
Minium absolute sum from 2 elements of 2 different lists |
|algorithms|arrays| |
I am currently stuck on this problem, it is from a very highly competitive contest and so it is highly difficult as well. here is the statement:
```
There are 2 lists of integers with the same length.
Pick an integer from each list and
calculate the absolute value of their sum.
Return the minimum value for the... |
**An $O(N\log N)$ solution:**
Sort the second list. For every element of the first, let $e$, find the two elements just smaller and just larger than $-e$, by dichotomic search. Then keep the largest absolute sum so far.
|
**An $O(n\log n)$ solution:**
Sort the second list. For every element of the first, let $e$, find the two elements just smaller and just larger than $-e$, by dichotomic search. Then keep the smallest absolute sum. It is possible that one of the two elements does not exist.
E.g. $-7,-3,4, 6$ vs. $-2,-1,4,9$.
$\... |
The purpose of this inverted page table is to reduce the amount of physical memory needed to track virtual-to-physical address translations. We accomplish this savings by creating a table that has one entry per page of physical memory, indexed by the pair <process-id, page-number>. Because they keep information about w... |
null |
null |
Your image comes from M.Li and P.M.B. Vitányi: Kolmogorov Complexity and its Applications, Chapter 4 in Handbook of Theoretical Computer Science, vol. A, J. van Leeuwen Editor.
Both conjectures mentioned are of the form "(k+1)-head X automata are better than k-head X automata", so we can assume that k refers here ... |
Your image comes from M.Li and P.M.B. Vitányi: Kolmogorov Complexity and its Applications, Chapter 4 in Handbook of Theoretical Computer Science, vol. A, J. van Leeuwen Editor.
Both conjectures mentioned are of the form "(k+1)-head X automata are better than k-head X automata", so we can assume that k refers here ... |
null |
null |
A [Wang B-machine](https://en.wikipedia.org/wiki/Wang_B-machine) is Turing-complete and has only 4 instructions:
- `right`: Move head right.
- `left`: Move head left.
- `mark`: Mark square under head.
- `branch n`: If square under head is marked, jump to instruction $n$.
Inspired by [P′′](https://en.wikipe... |
What is the computational class of a reduced Wang B-machine? |
|turing-machines|computability|automata|computation-models|turing-completeness| |
null |
I found the following proof for the theorem that states "A light edge that crosses a cut that respects A is safe for A":
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/SKcok.png
See: https://www2.hawaii.edu/~janst/311_f19/Notes/Topic-17.html where also all the necessary definitions ar... |
safe edge theorem proof clarification |
|algorithms|graphs|minimum-spanning-tree|spanning-trees| |
Although correct, that statement, "$w(T') = w(T) - w(x,y) + w(u,v) \le w(T)$" alone is indeed confusing, since it leaves the impression that $w(T')$ might be smaller than $w(T)$.
Well, the equal part of "$\le$" comes to rescue. It is possible that $w(T')=w(T)$.
Indeed, that must be the case, since we also have $... |
Although correct, that statement, "$w(T') = w(T) - w(x,y) + w(u,v) \le w(T)$" alone is indeed confusing, since it leaves the impression that $w(T')$ might be smaller than $w(T)$.
Well, the equal part of "$\le$" comes to rescue. It is possible that $w(T')=w(T)$.
Indeed, that must be the case, since we also have $... |
I have a list of apps the user has installed, a history of all previously opened apps, and a series of characters that the user has input.
The user is shown a list of apps filtered taking into account the input, the specific function should be given, but the app the user wants must never be filtered out. The list of... |
What is a good model for predicting which item the user will select from a list? |
|sorting|user-interface| |
If you don't want the character input to affect the list of most probable apps, don't use the character input to predict the list of suggested apps.
If you use the character input to predict a list of suggested apps, then changing the character input has the possibility to change the list of suggested apps.
Alter... |
I am trying to find the asymptotic run time complexity of the following function which will return a list of all permutations of nums.
```python
def permute(nums):
res = []
dfs(nums, [], res)
return res
def dfs(nums, curr, res):
if not nums:
res.append(curr)... |
Runtime complexity of permutation function |
|time-complexity|runtime-analysis|recursion|backtracking|depth-first-search| |
Arrays are generally presented as data structures with O(N) traversal and O(1) random element access. However, this seems inconsistent:
- if array access is really O(1), this means that the size of an element index has a fixed size (e.g., int64), since it can be processed in O(1). However, this implies that the arra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.