Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions about the science and art of determining properties of algorithms, often including correctness, runtime and space usage. Use the [runtime-analysis] tag for questions about the runtime of algorithms.
1
vote
Why does $O(n \log n)$ seem so linear?
Just some general observations.
O(n log n) is only an upper bound. If it's not tight, that's your explanation right there.
A Θ(n log n) running time can have many different components, for instance
…
3
votes
Accepted
How do I determine the basic operation of this algorithm?
"Basic operations" are whatever you choose. You may get different results based on your choice, which is great as it leads to understanding algorithms better! You may have seen the number of compariso …
3
votes
What is the difference between Big O and Theta notation in terms of inputs?
The best case runtime of insertion sort is linear, i.e. $\Theta(n)$. Therefore, there is no $\Theta(n^2)$ bound on all inputs, since that would require $\Omega(n^2)$ on all inputs.
This is just one e …
2
votes
Computation time of a Binom matlab (or C) routine
If you can avoid it, you don't want to compute sums like that at all.
If you compute terms like $p^k$ directly, you'll get big errors due to floating-point precision (because your result will be alm …
2
votes
Is every algorithm on bounded resources O(1)
By definition, every algorithm (that always halts) on a finite domain has $O(1)$ running-time: pick $n_0 > \max \{ |x| \mid x \in D\}$ with $D$ the input domain of the algorithm.
However, that fact …
3
votes
Cost of break statement
Depends on how close you want to look.
On face value, break, continue, etc. are implemented by unconditional jumps, which are (under most RAM-/CPU-like models) primitive instructions of the machine. …
2
votes
Accepted
Solving complexity using summation
Finding a suitable sum here is a bit awkward since sums in mathematics tend to step up by one, always. So we have to normalize the sequence of values of i
$\qquad i = 1, 2, 4, 8, \dots [i<n]$
to
$\ …
3
votes
Accepted
The Potential function for Fibonacci heaps
Because it works.
In amortized analysis, you pick the potential function. While it's usually related to some insight about the data structure or algorithm work, is it per se completely arbitrary. The …
3
votes
Accepted
Why and how geometric series are used for proofs?
The pattern appears often because many randomly controlled loops behave like a series of coin flips!
Consider this sketch:
while P(state)
do(state)
If the different evaluations of P are stocha …
2
votes
Accepted
Time Complexity of reconstructing corrupted file
Some remarks of general nature since I think you're operating based on flawed assumptions.
Removing spaces is not unambiguously reversible (unless your dictionary is prefix-free, or restricted in ot …
2
votes
Trying to understand CLRS bucket sort analysis
You are asking why
$\qquad\displaystyle \sum_{j=1}^{n}\sum_{k=1}^{n}X_{ij}X_{ik}
\quad=\quad \sum_{j=1}^{n}X_{ij}^2 + \sum_{j = 1}^{n}\sum_{1 \leq k \leq n,\\ k \neq j}X_{ij}X_{ik}$
holds (in expec …
0
votes
Accepted
Iterative DFS space complexity O(|E|)? Same vertex appears multiple times in stack?
why would one want to allow multiple occurrences of a same vertex in the stack
For general remarks, I can only guess here since I can't read the minds of others.
A recursive method incurs quite …
1
vote
Worst time complexity for finding a median number for a list and array data structure
The term "data structure" typically refers to a way to organize/store data, and the operations to create, maintain, and access them.
The asker is probably expecting you to assume specific implementat …
5
votes
Is there really a $ O(1/n) $ algorithm?
Considering that even the algorithm
return 1
has $\Omega(1)$ running-time cost, it seems obvious that running-time in $o(1)$ is impossible.
Other cost measures are often equated with running time, …
3
votes
Can I use Θ if tightest lower and upper bound are not the same?
When analyzing the asymptotic running time of an algorithm where the tightest lower bound and upper bound are not the same, is it bad to denote the running time in theta notation?
Do you mean to …