-1

I am currently working on the chapter 4 of the CLRS and trying to solve an exercice, I want to prove that the solution to T(n) = T(⌈n/2⌉)+1 is O(lg(n)) ( lg in base 2 ). In fact I already succeeded with basic algebric manipulation but I wanted to try another method and I clearly see there is a problem on this try but I don't know what is it, please help me.

Here is the reasoning I propose : I want to proceed by change of variables. A change of variables is basically the creation of a new variable m with m = f(n) for a particular function f : N -> N. I will not choose a candidate for f for now. Let's write some algebra. Supposing that the bound is true for any natural number x such as x < m, lets proove it is true for m as well. By hypothesis, we do have T(m) <= c*lg(⌈m/2⌉)+1 for a positive constant c and our objective is to show that T(m) <= c*lg(m). We will try to do this by prooving that c*lg(m) >= c*lg(⌈m/2⌉)+1 ( which is greater than T(m) as we said ).

c*lg(m) >= c*lg(⌈m/2⌉)+1 is equivalent to c*lg(m)-c*lg(⌈m/2⌉) >= 1 which is equivalent to c*(lg(m)-lg(⌈m/2⌉)) >= 1 which is equivalent to lg(m)-lg⌈m/2⌉ >= c which is equivalent to lg(m/(⌈m/2⌉)) >= c ( because of the logarithm properties ) which is equivalent to m/⌈m/2⌉ >= exp(c) which is equivalent ( by definition of m ) to f(n)/⌈f(n)/2⌉ >= exp(c). As f takes an integer and gives an integer, we can write that ⌈f(n)/2⌉*2 = f(n) so f(n)/⌈f(n)/2⌉ >= exp(c) is equivalent to f(n) >= exp(c)*⌈f(n)/2⌉ which is equivalent to 2*f(n) >= exp(c)*f(n) which is totally equivalent to 2 => exp(c) AND f(n) >= 0 so, as we worked only with equivalences, we can conclude that c*lg(m) >= c*lg(⌈m/2⌉)+1 is completely equivalent to 2 => exp(c) AND f(n) >= 0 no matter the value of m, no matter the value of f(n) ( even a constant or a random function seems to work the only important things being it is not negative ) the only thing that matters is 2 => exp(c) and f(n) >= 0 ( which means c <= 1 ( which is very very strange for me by the way ) and f(n) >= 0 )

Can you help me to know where is the error ( if there is one but it seems obvious to me ) in my reasoning please ? Thank you

Ryan Talbi
  • 11
  • 4

1 Answers1

0

I think you’re getting tripped up by the notation f(n) = m. This could mean one of two different things:

  1. There is a function f. There is also a specific, fixed integer n. And it happens to be the case that f, evaluated at n, gives back m. But we’re not making any assumptions about, say, what f(n - 1) evaluates to or what f(n + 1) evaluates to.
  2. There is a function f. Regardless of what you plug into f, you get m.

With that said, let’s look at your conclusion:

we can conclude that clg(m) >= clg(⌈m/2⌉)+1 is completely equivalent to 2 => exp(c) AND f(n) >= 0 no matter the value of m, no matter the value of f(n) ( even a constant or a random function seems to work the only important things being it is not negative)

Under interpretation (1), this statement is not correct. It’s not true that “no matter the value of f(n)” the statement holds, because you specifically need to have f(n) = m. However, under interpretation (1), that’s fine. We don’t know what f does for inputs other than the specific choice of n where f(n) = m. What you could claim is “for any function f and any input n where f(n) = m, we know that c lg f(n) ≥ c lg ⌈ f(n) / 2 ⌉ holds if […].” But that’s not a very interesting statement, since this doesn’t allow us to extrapolate to what f does to inputs other than n. In a sense, all you’ve done is rename m to f(n), but that doesn’t tell you anything about f outside of that one input.

Under interpretation (2), the statement is incorrect because you specifically must assume that f(n) = m for all n.

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065