I'm looking at Mattson's Stack Distance Algorithm for finding the hit ratio curve for cache. The paper stated that it runs in O(N*M). I'm trying to figure out if this is O(N) or O(N^2).
Good day! I saw a backtracking subset-generation algorithm in the link:
https://www.geeksforgeeks.org/backtracking-to-find-all-subsets/
which claims that the space complexity of the program is O(n). Yet, from what I've learned, the minimum complexity should be O(2^n) since it will be the size of our output. Is the given space complexity correct?
I have implemented an A* algorithm which makes use of min priority queue. Now the implementation is very similar to the uniform-cost search which has time complexity of O(mlogn) and space complexity O(n^2) - since it keeps track of the parents and the nodes traversed using A*. Doesn't the time and space complexity for A* remain the same? Because in all the explanations that I am finding, the time and space complexity of A* is O(b^n)
Wikipedia says the following on A*'s complexity:
The time complexity of A* depends on the heuristic. In the worst case,
the number of nodes expanded is exponential in the length of the
solution (the shortest path), but it is polynomial when the search
space is a tree...
And my question is: "Is A*'s time complexity exponential? Or is it not a time complexity, but memory complexity?"
If it is memory complexity, which time complexity does A* have?
In the worst case A* time complexity is exponential.
But, consider h(n) the estimated distance and h*(n) the exact distance remaining.
If the condition | h(n) - h*(n) | < O(log *h(n) ) holds, that is, if the error
of our estimate functions grows subexponential, then A* time complexity will be
polynomial.
Sadly, most of the time the estimate error grows linear, so, in practice,
faster alternatives are preferred, the price paid being the fact that optimality
is not achieved anymore.
Since each expanded node is stored to avoid visiting the same node multiple times, the exponential growth of the number of expanded nodes implies exponential time and space complexity.
Please note that exponential space complexity necessary implies exponential time complexity. The inverse is not true.
Is A* time complexity exponential or it's memory complexity?
That extract from Wikipedia suggests that that it's referring to time complexity
If we know the lower bound for the time complexity of a problem is Ω(n^2), am I correct in thinking it is not possible to have an algorithm with worst-case time complexity O(n log n)?
If the lower bound for the time complexity of a problem is Ω(n^2), then that means an algorithm solving this problem has to take at least C*n^2 time.
On the other hand, you have an algorithm that takes at most K*n*logn time.
This algorithm cannot run any longer than nlogn. What you need is an algorithm that runs at least n^2 time.
Therefore; it is impossible for this algorithm to solve this problem. You are correct.