Answered By : Neal Young If edge weights are integers in ${0,1,ldots,K}$, you can implement Dijkstra’s to run in $O(K|V|+|E|)$ time, following @rrenaud’s suggestion. Here is a more explicit explanation. At any time, the (finite) keys in the priority queue are Read More …
Blog
Why is a quantum computer not capable of solving more problems than a classical computer?
Answered By : David Richerby Because a quantum computer can be simulated using a classical computer: it’s essentially just linear algebra. Given a probability distribution for each of the qubits, you can keep track of how each quantum gate modifies those Read More …
Practical Applications of Radix Sort
Answered By : Wandering Logic Radix sorts are often, in practice, the fastest and most useful sorts on parallel machines. Zagha and Blelloch: Radix sort for vector multiprocessors. Supercomputing, 1991: 712-721. Blelloch, Leiserson, Maggs, Plaxton, Smith, and Zagha: A Comparison of Read More …
How can I prove that a build max heap’s amortized cost is $O(n)$?
Answered By : A.Schulz I assume that the operation build just turns an array into a heap by repairing the heap-property for every subtree bottom-up (let the operation for a single repair step called heapify). It is not so hard to Read More …
Why and how is a quantum computer faster than a regular computer?
Answered By : Alexey Romanov A quantum computer by itself isn’t faster. Instead, it has a different model of computation. In this model, there are algorithms for certain (not all!) problems, which are asymptotically faster than the fastest possible (or fastest Read More …
Applying Expectation Maximization to coin toss examples
Answered By : Nicholas Mancuso (This answer uses the second link you gave.) $newcommand{Like}{text{L}}newcommand{E}{text{E}}$Recall the definition of likelihood: $$Like[theta | X] = Pr[X| theta] = sum_Z Pr[X, Z | theta]$$ where in our case $theta = (theta_A, theta_B)$ are the estimators Read More …
Why are these (lossless) compression methods of many similar png images ineffective?
Answered By : Raphael Have a look at how compression algorithms work. At least those in the Lempel-Ziv family (gzip uses LZ77, zip apparently mostly does as well, and xz uses LZMA) compress somewhat locally: Similarities that lie far away from Read More …
Theoretical machines which are more powerful than Turing machines
Answered By : Yuval Filmus The Church–Turing thesis (in one formulation) states that everything that can be physically computable can also be computed on a Turing machine. Assuming you believe this theses, and given that you’re interested in functions which such Read More …
What is the advantage of Randomized Quicksort?
Answered By : Jernej If the input array is distributed uniformly at random then (as you noted) there is no difference between always picking an element at a fixed position (for example the middle one as you suggest) or picking an Read More …
Complexity of Towers of Hanoi
Answered By : JeffE No, the problem you’ve described is actually quite easy. The high-level reason is that the index $i$ is roughly $n$ bits long, so we can actually afford to spend time polynomial in $n$. Consider the following related Read More …