instruction stringlengths 0 29.8k ⌀ |
|---|
null |
If you have T(n) <= c n log n for all n < N, then you show that T(N) <= 3 c N log N. That’s just not good enough.
It seems that T(n) for large n is quite exactly 6 times the average of all smaller values. T(n) = c * n^5 would do that. And c * n^4 wouldn’t. Integral of n^5 is n^6/6, times 6/n is n^5 again.
I’d s... |
Hello I am trying to implement Non Max suppression algorithm for removing overlapping bounding boxes. I have a list of bounding detected by an object detector in the format B(x,y,w,h,s)
x,y are coordinates, w,h are size, and s is confidence score.
Aim of NMS is to remove overlapping boxes and retaining only ones with... |
Comparing a greedy and a brute force algorithm for NMS |
|algorithms|greedy-algorithms| |
Given an $n$ input array, is there an algorithm that is faster than Fast Fourier Transform if we are only interested in the maximum amplitude frequency?
Looking at the Cooley–Tukey algorithm it seems there would be a way to "prune" outputs that are guaranteed to not be maximum amplitude.
The application seems com... |
Is there a faster algorithm than FFT if interested only on the maximum amplitude frequency? |
|time-complexity|fast-fourier-transform| |
null |
null |
Given an $n$ input array, is there an algorithm that is faster than Fast Fourier Transform if we are only interested in the maximum amplitude frequency?
Looking at the Cooley–Tukey algorithm it seems there would be a way to "prune" frequencies that are guaranteed to not be maximum amplitude.
The application seems... |
Suppose we want to find a vector $x\in R^n$ that satisfies the constraints $g_i(x)\leq 0$, for $i\in 1,\ldots, m$, where all $g_i$ are convex functions.
This is a special case of convex programming, and it is known that it can be solved (at least approximately) by the ellipsoid method.
But to use the ellipsoid meth... |
Computing an initial ellipsoid for solving a convex program |
|optimization|numerical-analysis|convex-hull| |
Given an $n$ input array, is there an algorithm that is faster than Fast Fourier Transform if we are only interested in obtaining the maximum amplitude frequency?
Looking at the Cooley–Tukey algorithm it seems there would be a way to "prune" frequencies that are guaranteed to not be of maximum amplitude.
The appl... |
null |
This is an example algorithm of a recursive insertion sort I'm trying to understand. I've have tried understanding this with
the help of print statements (which I've commented).
def ins_sort_rec(seq, i):
if i == 0:
return
# print(f"{' ' * i} starting at depth {i}")
... |
Diffucuty in understanding code after a recursive call |
|algorithms|sorting|recursion|python| |
Create an AVL tree with nodes containing unique integers and count
then do inorder traversal
Since there are k distinct integers , the height of tree will grow upto atmost k , evenif k is unknown
Each insertion or updation will take logk time , and building this tree will take nlogk
Inorder Traversal is O(n)
To... |
Create an AVL tree with nodes containing unique integers and their respective counts in set
then simply do inorder traversal
Since there are k distinct integers , the height of tree will grow upto atmost k , evenif k is unknown
Each insertion or updation will take logk time , and building this tree will take nlog... |
Create an AVL tree with nodes containing unique integers as keys and their respective counts
then simply do inorder traversal
Since there are k distinct integers , the height of tree will grow upto atmost k , evenif k is unknown
Each insertion or updation will take logk time , and building this tree will take nlo... |
null |
**To answer fist question**: notice that we chose v whose distance did change and that has the smallest new distance. If u's distance did change after the augmentation, then we could have picked u instead of v because its new distance is smaller than that of v but since we chose v, we know that u's distance after augme... |
null |
The Curry-Howard correspondence is **not crucial** for functioning of a proof assistant. Unforunately, the term "Curry-Howard correspondence" seems to be misused nowadays for all sorts of things.
My understanding is that a Curry-Howard correspondence arises when one exhibits a translation (in both directions!) betwe... |
null |
The Curry-Howard correspondence is **not crucial** for functioning of a proof assistant. Unforunately, the term "Curry-Howard correspondence" seems to be misused nowadays for all sorts of things.
My understanding is that a Curry-Howard correspondence arises when one exhibits a translation (in both directions!) betwe... |
I have following language L:= {$a^n b^n c^m | n \neq m; n,m >= 0 $} and would like to use proof by contradiction by applying Pumping Lemma for CFLs to show that L is not a CFL.
In any case, i need to choose w = $uv^iwx^iy$ so that w $\in$ L for all i $\in N_0$.
I tried $a^p b^p c^{p+1}$ , $a^p b^p c^{p+p!}$ (p - ... |
How to prove $L := {a^n b^n c^m | n,m >= 0 & n != m}$? |
|formal-languages|context-free|pumping-lemma| |
I have following language L:= {$a^n b^n c^m | n \neq m; n,m >= 0 $} and would like to use proof by contradiction by applying Pumping Lemma for CFLs to show that L is not a CFL.
In any case, i need to choose w = $uv^iwx^iy$ so that w $\in$ L.
I tried $a^p b^p c^{p+1}$ , $a^p b^p c^{p+p!}$ (p - Pumping Length) and ... |
I have following language L:= {$a^n b^n c^m | n \neq m; n,m >= 0 $} and would like to use proof by contradiction by applying Pumping Lemma for CFLs to show that L is not a CFL.
In any case, i need to choose w = $uv^iwx^iy$ so that w $\in$ L.
I tried $a^p b^p c^{p+1}$ , $a^p b^p c^{p+p!}$ (p - Pumping Length) and ... |
I was reading the [Book: The Art of Multiprocessor Programming; Section 2.3.2](http://dl.acm.org/citation.cfm?id=1734069). and I have a doubt regarding their $\texttt{LockTwo}$ algorithm mentioned in Page 26.
The snippet of the algorithm is:
```java
class LockTwo implements Lock {
private volatile int vic... |
Deadlock in LockTwo Algorithm |
|operating-systems|synchronization|deadlocks|critical-section| |
null |
As [Wikipedia states](https://en.wikipedia.org/wiki/CYK_algorithm):
> The importance of the CYK algorithm stems from its high efficiency in certain situations.
In particular, its relevance is that it allows parsing an arbitrary context-free grammar, with running time that is polynomial in the input size (in parti... |
null |
Your description of the problem and your solutions are not very accurate. I will rephrase as follows: "any rectangle that has a sufficient overlap with another rectangle of a higher score must be discarded".
With this interpretation, you have to proceed by *increasing scores*, to make sure that you don't discard a r... |
null |
null |
null |
I am investigating a floating point number bug in CCL (Clozure Common Lisp), which since Common Lisp is using an old standard by default 32 bit IEEE 753 float known as `single-float` in most implementation is used.
The bug is demonstrate by the observation that converting a rational number to `single-float` could be... |
I am reading the book: Digital Design and Computer Architecture: ARM Edition
I am on the chapter about virtual memory. I am wondering, when a page fault occurs, is it the processor or the OS that "fixes it". In the text below they first say that the processor fixes it, then they say it is the OS that fixes it.
D... |
Page fault, virtual memory |
|virtual-memory|page-replacement| |
[Partial FFT](https://github.com/snudatalab/PFT) and [Sparse FFT](https://github.com/andrii619/SparseFFT) can exploit an expected range of said maximum.
Practically, the range of frequencies over which the maximum may occur is often known. There are also approaches to estimate said location. These are signals, not a... |
I have following language $L:= \{a^n b^n c^m \mid n \neq m; n,m \ge 0 \}$ and would like to use proof by contradiction by applying Pumping Lemma for CFLs to show that $L$ is not a CFL.
In any case, i need to choose $w = uv^iwx^iy$ so that $w \in L$.
I tried $a^p b^p c^{p+1}$ , $a^p b^p c^{p+p!}$ ($p$ - Pumping Le... |
How to prove L := { a^n b^n c^m | n,m >= 0 & n != m } is not context-free? |
Your analysis is correct. In order to keep the $a^n b^n c^m$ structure of the string, the only ways to pump are case (1) pump both $a$'s and $b$'s, or case (5) pump only $c$'s. All other case will distroy the structure of the string.
You applied the $p!+p$-trick, and consider the string $a^p b^p c^{p!+p}$. In case ... |
null |
Both. The OS is software that executes on the processor. |
null |
In my reference, [Page 26, Algorithms by Sanjoy Dasgupta, Christos H. Papadimitriou, and Umesh V. Vazirani,][1] a division algorithm is give as,
\begin{align}
&\text{function divide}(x, y)\\\\
&\text{Input: Two n-bit integers x and y, where }y ≥ 1\\\\
&\text{Output: The quotient and remainder of x divided by y}\\\\... |
Understanding the Recursive Division Algorithm |
|algorithms|recursion| |
null |
Understanding the Recursive Algorithm for Integer Division |
null |
Your analysis is correct. In order to keep the $a^n b^n c^m$ structure of the string, the only ways to pump are case (2) pump both $a$'s and $b$'s, or case (5) pump only $c$'s. All other case will distroy the structure of the string.
You applied the $p!+p$-trick, and consider the string $a^p b^p c^{p!+p}$. In case ... |
Let me take the set $A = \{1, 2\}$ as the alphabet. By the bijective binary numeral system, $A^*$ has one-to-one correspondence to the set of nonnegative integers $\mathbb{N}$. As such, each language $L \subset A^*$ corresponds to a subset of $\mathbb{N}$.
Now consider the power set of $\mathbb{N}$, and treat its el... |
Is NP a subring of the 2-adic integers? |
|complexity-theory|time-complexity|p-vs-np|algebra| |
How do i prove that the regular expression $$a^*(ba^*)^*$$ is the same as $$(a+b)^*$$. Is there a way to prove this using regular expression identities? |
How to simplify this regular expression? |
|regular-languages|regular-expressions| |
Insertion into a heap is an O(logn) operation. Insertion of n elements into a heap one by one is summarised as O(n * logn). I wonder about the math behind this, because I could not reach to the same outcome.
Let's say we have an empty heap h = [].
- The first insertion will be a constant time operation, say O(1)... |
The math behind the time complexity of Heap Insertion |
|time-complexity| |
Today, I came across the notation `3[arr]` in C++, and I was surprised to find out that it's a valid way to access array elements. For example:
```cpp
int arr[] = {10, 20, 30};
int element = 1[arr]; // This compiles and works!
```
Online IDE: https://onlinegdb.com/4o8qnsx8O
The assembly of this looks exactl... |
Why is `3[arr]` notation of accessing elements in array is not used? |
|arrays|memory-management|c| |
null |
$$\ln(n!)=\ln\left(\prod_{k=1}^nk\right)=\sum_{k=1}^n\ln(k)\approx\int_{k=0}^n\ln(t)\,dt=(t\ln(t)-t)\Big|_{t=0}^n=n\ln(n)-n.$$
One can show that the approximation error does not impact the asymptotic behavior. |
null |
hopefully I'm writing this post in the adequate place if not please move my post
I'm reading this paper about L-shaping fitting for vehicles. and ran into this optimization in the photo attached.
in the paper it is written that due to the combinatorial complexity of the partition problem it is not easy to solve the o... |
optimization problem in CV |
|optimization|computer-vision| |
hopefully I'm writing this post in the adequate place if not please move my post
I'm reading this paper about L-shaping fitting for vehicles. and ran into this optimization in the photo attached.
in the paper it is written that due to the combinatorial complexity of the partition problem it is not easy to solve the o... |
hopefully I'm writing this post in the adequate place if not please move my post
I'm reading this paper about L-shaping fitting for vehicles. and ran into this optimization in the photo attached.
in the paper it is written that due to the combinatorial complexity of the partition problem it is not easy to solve t... |
[![enter image description here][1]][1]hopefully I'm writing this post in the adequate place if not please move my post
I'm reading this paper about L-shaping fitting for vehicles. and ran into this optimization in the photo attached.
in the paper it is written that due to the combinatorial complexity of the part... |
hopefully I'm writing this post in the adequate place if not please move my post
I'm reading this paper about L-shaping fitting for vehicles. and ran into this optimization in the photo attached.
in the paper it is written that due to the combinatorial complexity of the partition problem it is not easy to solve t... |
Consider the following "game".
> There is an ant on a strip of length N. The ant can perform the following actions: move left, move right, and paint the cell he is on with white or black. The ant is also given a target coloring and must paint the strip according to such coloring in the most efficient way possible. The... |
Consider the following "game".
> There is an ant on a strip of length N. The ant can perform the following actions: move left, move right, and paint the cell he is on with white or black. The ant is also given a target coloring and must paint the strip according to such coloring in the most efficient way possible. The... |
Suppose $x$ is divided by $y$, and the quotient is $q$ and remainder is $r$. Then, it means the following:
$$x = q \cdot y + r \quad \quad \textrm{where} \quad r < y. \quad \quad (1)$$
Consider the case when $x = even$. Then, $x = 2x'$. Suposse that $x'$ when divided by $y$ gives quotient $q'$ and remainder $r'... |
null |
**Overview of 5-state holdouts**
All 4-state machines [have been proven in 1983](https://www.jstor.org/stable/2007539). As of 2023 it is generally believed that all [5-state machines have been decided pending only better verification and perhaps boring proofs analogous to other existing proofs](https://discuss.bbcha... |
Consider the following "game".
> There is an ant on a strip of length N. The ant can perform the following actions: move left, move right, and paint the cell he is on with white or black. The ant is also given a target coloring and must paint the strip according to such coloring in the most efficient way possible. The... |
There is actually a quite simple greedy algorithm that lets us pick one interval after the other in an optimal way. At any point we do the following:
1. Find the smallest i with $s_i > 0$. If there is no such i then we are done. If there is a smallest i, then we need to pick an interval containing i at some point, ... |
Its because nand is another statement for distinction/contradiction --- contradictions are bad in logic because they make 'every possible statement true and its possible to build a contradiction out of a NAND more or less directly (just negate one input and tie them together). This is the deeper theoretical reason for ... |
Lets consider a range of "K" binary digit numbers. In that range, we want to take a subset of those values which have (<="n" consecutive 0s) AND (<="n" consecutive 1s).
Then, we want to find the order of values in the resulting subset incrementally.
Also, we want to do the "un-ordering" of the values. i.e. find t... |
Order in a subset |
|combinatorics|sets|arithmetic|binary| |
null |
null |
null |
These are known as ranking and unranking algorithms. See, e.g., https://computationalcombinatorics.wordpress.com/2012/09/10/ranking-and-unranking-of-combinations-and-permutations/
Let $\text{rank}(x)$ denote the rank of $x \in \{0,1\}^K$, i.e., the number of $K$-bit strings that lexicographically precede $x$ and sa... |
Suppose we want to find a vector $x\in R^n$ that satisfies the constraints $g_i(x)\leq 0$, for $i\in 1,\ldots, m$, where all $g_i$ are convex functions. The functions can be given by an oracle access: there is an oracle that, given x, returns $g_i(x)$. If this helps, we can also have an oracle for their derivative $g_i... |
null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.