Understanding Big-Oh Problems with Two Parts

  • Thread starter IcyBlueRose
  • Start date
  • Tags
    parts
In summary: Anyway, in summary, the problem is that the author is not understanding what the problem is asking and that he is not completely understanding the definitions.
  • #1
IcyBlueRose
5
0
I'm having a problem with a Big-Oh problem, and I think it's more that I'm not understanding what the problem is asking and that I'm not completely understanding the definitions. There are two parts of the problem:

Here is the problem verbatim:
********************************************************
Assume you have functions f and g such that f(n) is O(g(n)). For each of the following statements, decide whether you think it is true or false and give a proof or counterexample.

A. log2 f(n) is O(log2 g(n)).
B. f(n)^2 is O(g(n)^2 ).

*********************************************************
(In part a the 2 is a subscript)

Does anyone have any pointers? The book I'm using doesn't give an example like it, so I'm not even really sure what it's asking.
 
Physics news on Phys.org
  • #2
Assuming [tex] O [ g ( n ) ] [/tex] is a composite function, let:
[tex] g\left( n \right) = 5n [/tex]
[tex] O\left( n \right) = 4n [/tex]

And so,
[tex] \therefore f\left( n \right) = O\left[ {g\left( n \right)} \right] \Rightarrow f\left( n \right) = 20n [/tex]

*However, for Part A:
[tex] \log _2 20n \ne 4\log _2 \left( {5n} \right) , n \ne \frac{{2^{\frac{2}
{3}} }}{5} [/tex]

*And for Part B:
[tex] 400n^2 \ne 4\left( {25n^2 } \right) , n \ne 0 [/tex]
 
Last edited:
  • #3
bomba923 said:
A counterexample?
Assuming [tex] O [ g ( n ) ] [/tex] is a composite function, let:
[tex] g\left( n \right) = 5n [/tex]
[tex] O\left( n \right) = 4n [/tex]

And so,
[tex] \therefore f\left( n \right) = O\left[ {g\left( n \right)} \right] = f\left( n \right) = 20n [/tex]

*However, for Part A:
[tex] \log _2 20n \ne 4\log _2 \left( {5n} \right) [/tex]

*And for Part B:
[tex] 400n^2 \ne 4\left( {25n^2 } \right) , n \ne 0 [/tex]

Both (a) & (b) are false, I believe.
What are you talking about?
That is not a composite function.
http://mathworld.wolfram.com/AsymptoticNotation.html
 
Last edited:
  • #4
lurflurf said:

bomba923 said:
Assuming [tex] O [ g ( n ) ] [/tex] is a composite function,

Sorry :redface: had no idea this was of asymptopic notation!
well, I thought it was just a normal composite function, like those in early algebra :frown:

Then again, it would have been
K-12 forum in that case :blushing:
Sorry--sorry
 
Last edited:
  • #5
So
f(n) is O(g(n)) means
|f(n)|<A*g(n) for some constant A
You should state if this is for all n, or in the limit.
Also is f>0
I will assume f>0 so that
0<f(n)<A*g(n)
if s(x) is strictly increasing when x>0
ie
s(x+y)>s(x) whenever x,y>0
then
f(n)<A*g(n)
implies
s(f(n))<s(A*g(n))
x^2 and log2(x) meet this requirement and each allow further simplification
f(n)<A*g(n)
so
(f(n))^2<(A*g(n))^2
(f(n))^2<(A^2)*(g(n))^2
is
(f(n))^2 is O((g(n))^2)
true?
f(n)<A*g(n)
log2(f(n))<log2(A*g(n))
log2(f(n))<log2(A)+log2(g(n))
This puts much doubt on
log2 f(n) is O(log2 g(n))
consider f(n)=2^(-n^2) g(n)=2^(-n)
f(n)<2*g(n)
so
f(n) is O(g(n))
log2 f=-n^2 log2 g=-n
so we have g<0 hance falsehood, but even if
log2 f(n) is O(|log2 g(n)|) were intended
n^2 is O(n) is also false
 
  • #6
The book I'm using doesn't give an example like it, so I'm not even really sure what it's asking.

There are examples in your calculus book. :tongue2: (At least if you've learned the theorem that characterizes asymptotic notation in terms of limits)

But honestly, these are straightforward with the algebraic definition as well.
 
  • #7
Thanks for the pointers.

No, there aren't examples in my calc book :smile: I've taken calc I, II and III, but this is for my Algorithms computer science class.
 
  • #8
Drat. Sucked in by a thread title again.

Should have wised up when I noticed that the topic section wasn't Biology...
 

1. What is the purpose of understanding Big-Oh problems with two parts?

The purpose of understanding Big-Oh problems with two parts is to analyze the efficiency of algorithms and their performance in terms of time and space complexity. It helps in determining the scalability of algorithms and identifying areas for improvement.

2. What are the two parts of Big-Oh notation?

The two parts of Big-Oh notation are the function representing the running time of an algorithm and the input size. The function represents the number of operations performed by the algorithm, while the input size represents the size of the input data.

3. How is Big-Oh notation used to compare algorithms?

Big-Oh notation is used to compare algorithms by looking at the growth rate of their running time as the input size increases. The algorithm with a smaller growth rate (lower order) is considered more efficient and preferred for larger inputs.

4. What is the difference between Big-Oh and Big-Omega notation?

The main difference between Big-Oh and Big-Omega notation is the direction of the comparison. Big-Oh notation represents the upper bound of an algorithm's running time, while Big-Omega notation represents the lower bound. In other words, Big-Oh notation gives an upper limit on the algorithm's performance, while Big-Omega notation gives a lower limit.

5. How can understanding Big-Oh problems with two parts help in algorithm design?

Understanding Big-Oh problems with two parts can help in algorithm design by providing a framework for analyzing and improving the efficiency of algorithms. By identifying the dominant operations and their growth rate, developers can make informed decisions on optimizing the algorithm's performance. It also helps in predicting the algorithm's behavior for larger inputs.

Similar threads

  • Introductory Physics Homework Help
Replies
8
Views
762
  • Introductory Physics Homework Help
Replies
7
Views
98
  • Introductory Physics Homework Help
Replies
18
Views
1K
  • Introductory Physics Homework Help
Replies
3
Views
187
  • Introductory Physics Homework Help
Replies
5
Views
670
  • Introductory Physics Homework Help
Replies
2
Views
613
  • Introductory Physics Homework Help
Replies
34
Views
666
  • Introductory Physics Homework Help
Replies
6
Views
1K
  • Introductory Physics Homework Help
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
3
Views
357
Back
Top