I got a practice exam question here asking if the following is true/false.
Let f , g, and h be functions from the natural numbers to the positive
real numbers. Then if g is an element of Big Omega( f ) and g is an element of O(h), and f is an element of O(h) then g is an element of big Theta (h)
I got false for this but it is kind of confusing me now because I don't exactly know what Big omega(f) is.
Can someone clarify if my answer to this question is correct / if not, where I went wrong (and explain if possible please).
Thanks.
Check the link I mentioned in the comment. g is an element of big Theta (h) <=> g is bounded both above and below by h, which is not the case. From your post it's only can be deduced that g is bounded above by h. So "false" is correct answer.
Related
I'm currently trying to follow pseudocode for Dijkstra's Algorithm, but I'm having difficulty understand what one of the lines means.
DijkstrasAlgorithm(G, w, s)
InitalizeSingleSource(G, s)
S = 0
Q = G.V
while Q != 0
u = ExtractMin(Q)
S = S∪{u}
for each vertex v ∈ G.Adj[u]
Relax(u, v, w)
This part right here "S = S∪{u}" is what's confusing me. I'm not sure what S is supposed to be equal to. Could someone explain? Thanks!
That’s the set union operator. S here is the set of all nodes for which the shortest path has been computed, and this line means “add the node u to that set.”
Mechanically, S ∪ {u} is the set consisting of everything already in S, plus the node u. That’s why S = S ∪ {u} means to add u to S.
(As a note, I think the pseudocode has a typo in where S was declared. You probably meant to initialize it to the empty set ∅ rather than the number 0.)
Dijkstra’s algorithm is a pretty tough one to understand purely from pseudocode. I recommend checking out a tutorial somewhere so that you have a high-level intuition for what’s going on. It’s much easier to understand this pseudocode by mapping the contents onto your conceptual understanding.
How would i find the smallest positive integer for which algorithm B out-performs algorithm A?
A = n/4, B = 8×log2n(Base of 2 Not 2n)
A = n^3/10, B = 5×n2
A = n^2/2, B = 20×n×log2n(Base of 2 Not 2n)
A = n^4, B = 16×n2×n
It would be greatly appreciated if someone could help me find answers to these :)
You are really asking whether A(n) > B(n).
It is simple to answer to those questions:
solve the inequalities for n
You can also plot the two functions on the same plane and see how they behave and what is the relation among them. The following is for the first of your questions. As you can see it is clear from the graph when one outperforms the other.
For instance n^3/10 > 5×n^2 solves for n>50
http://www.wolframalpha.com/input/?i=n%5E3%2F10+%3E+5%C3%97n2
Consider asking this kind of questions on https://math.stackexchange.com/
Hope this helps
Imagine I have an equation like
A + B + C + D + E + F + G + H + … = Some Value
And every summand has an upper limit
A ≤ 500,
B ≤ 200,
C ≤ 300,
D ≤ 600,
…
If i want a program to determine every possible combination of the summands, would the problem be NP-complete?
How would the mathematical proof look like?
If not, how would an efficient algorithm for this problem look like?
To determine whether the problem is NP complete, you must first figure out if it is in NP. We need to create a decision question from the problem.
If you wanted to set a limit on the sum without actually having to determine all the combinations of the summands, the decision question could be: Are there limits for A, B, C... such that the sum is ≤ k? Then your certificate could be a set of limits on the summands.
Here, the decision question is unclear and a certificate cannot be verified. This problem, as it is phrased, is not in NP.
I have a question regarding big O notation.
If g(n)=O(f(n)) and h(n)=O(f(n)) is g(n)=O(h(n))?
Is this allways true, sometimes true or allways false?
Thanks
In words: if g is bounded by f and h is bounded by f, is g bounded by h?
From this we can see that the conclusion doesn't follow from the premises. You can construct a counterexample by choosing f, g, and h in such a way that the premises hold but the conclusion does not.
I've been trying for the better part of an hour to find reference to the following:
f = Ω(g)
But I have had no luck at all. I need to answer a question for an assignment and I can't find references.
The assignment is basically asking me to indicate what it (f = Ω(g)) means, in the context of the following choices:
f = Ω(g(n))
g = o(ln n)
g = o(g(n))
g = O(f)
f = O(g)
Initially, I thought that perhaps there is an error in the question.
I know option 1 is wrong and assume option 5 is also wrong, but after an hour online I couldn't figure out which one is the answer.
Can someone please explain to me how to figure this out? I realize that might mean giving me the answer so it can be explained, but I'm more interested in why one of these answers are correct.
"f = Ω(g) means "f is bounded below by g asymptotically". f = O(g) means "f is bounded above by g asymptotically" as per the comments.
If a river's upper bound is a bridge, what's a bridge's lower bound? The river.
I would suggest d
(For completeness, the "little" versions of these imply a very strong difference in growth.)