Is h(n) - f(n) in o(g(n)) Given f(n) in o(g(n)) and g(n) in O(H(n))?

  • Thread starter ammoun
  • Start date
  • Tags
    Complexity
In summary, the conversation is about the possibility of proving that h(n)-f(n) is in o(g(n)), using definitions of big O and small o. The initial poster presents a counterexample and asks for confirmation. The expert asks for clarification on the definitions and the relationship between H(n) and h(n). The conversation ends with the expert summarizing the topic of discussion and mentioning the definitions of big O and small o.
  • #1
ammoun
5
0
Hi

When we have f(n) [itex]\in[/itex] o(g(n)) and g(n) [itex]\in[/itex] O(H(n))

Can I proove that h(n)-f(n) [itex]\in[/itex] o(g(n))?

Obviously I don't want you to give me the answer, but some hints and maybe which definitions of O and o I should use.

Thanks
 
Physics news on Phys.org
  • #2
Ok, I believe I came up with a counter example:

If f(n)=n, g(n)=[itex]n^{2}[/itex] and h(n)=[itex]n^{3}[/itex]

When I looked for the limit of the difference / g(n) it cannot give 0.

Could you please confirm this result?

Thanks
 
  • #3
ammoun said:
Hi

When we have f(n) [itex]\in[/itex] o(g(n)) and g(n) [itex]\in[/itex] O(H(n))

Can I proove that h(n)-f(n) [itex]\in[/itex] o(g(n))?

Obviously I don't want you to give me the answer, but some hints and maybe which definitions of O and o I should use.

Thanks
What definitions are you talking about? Also how does H(n) relate to h(n). Forgive me for asking but I just don't know what you are referring to.
 
  • #4
ramsey2879 said:
What definitions are you talking about? Also how does H(n) relate to h(n). Forgive me for asking but I just don't know what you are referring to.

Thank you ramsey, it was the same function h and the definitions I'm talking about are of big O of a function and small o.

For example Big O of g(n) is the set of function f(n), f(n)≤c g(n). (not complete definition)
 
  • #5


Hello,

To prove that h(n)-f(n) \in o(g(n)), you can use the definition of little o notation, which states that for any positive constant c, there exists a positive integer n0 such that for all n > n0, |f(n)| < c|g(n)|. In other words, the rate of growth of f(n) is significantly smaller than that of g(n) as n approaches infinity.

To start, you can assume that h(n) and f(n) both belong to o(g(n)), meaning that for any positive constant c, there exists a positive integer n0 such that for all n > n0, |h(n)| < c|g(n)| and |f(n)| < c|g(n)|. Now, you can use these two inequalities to show that |h(n)-f(n)| < c|g(n)| for all n > n0. This will prove that h(n)-f(n) also belongs to o(g(n)).

I hope this helps. Best of luck with your proof!
 

FAQ: Is h(n) - f(n) in o(g(n)) Given f(n) in o(g(n)) and g(n) in O(H(n))?

What is Big O notation and how is it used to measure complexity?

Big O notation is a mathematical notation used to describe the efficiency of an algorithm or the complexity of a problem. It represents the upper bound of the worst-case scenario for the time or space required for a given algorithm to run. It is commonly used to compare different algorithms and determine which one is more efficient for solving a particular problem.

How is Big O notation different from little o notation?

While Big O notation represents the upper bound of the worst-case scenario, little o notation represents the lower bound of the best-case scenario for the time or space complexity of an algorithm. It is used to describe the fastest possible growth rate of an algorithm, and it can provide more precise measurements for highly efficient algorithms.

What is the significance of the "O" in Big O notation?

The "O" in Big O notation stands for "order of," which represents the order of magnitude of the growth rate of an algorithm. It is used to classify algorithms into different categories based on how quickly their time or space requirements grow as the input size increases.

How do you calculate the complexity of an algorithm using Big O notation?

To calculate the complexity of an algorithm using Big O notation, you need to determine the number of operations performed by the algorithm as the input size increases. Then, you can express this number of operations as a function of the input size, and simplify it to find the highest order term. This term will be the complexity of the algorithm, represented by the Big O notation.

Can Big O notation be used for all types of algorithms?

Yes, Big O notation can be used for all types of algorithms, including both simple and complex ones. It is a universal method for measuring the efficiency and complexity of algorithms and can be applied to any algorithm regardless of its purpose or implementation. However, it is more commonly used for analyzing time and space complexities of algorithms in computer science and data analysis fields.

Similar threads

Replies
6
Views
1K
Replies
7
Views
2K
Replies
1
Views
1K
Replies
9
Views
2K
Replies
24
Views
3K
Replies
1
Views
1K
Replies
4
Views
2K
Back
Top