Explain this simplification of how the $\lfloor n/2\rfloor=n/2 - 1$

105 Views Asked by At

I'm having trouble locating a rule and understanding how the floor of $n/2$ can simplify to $n/2 - 1$.

$$ T(n) \geq 2d \lfloor\frac{n}{2}\rfloor \lg \lfloor\frac{n}{2}\rfloor + n $$ $$ \geq 2d (\frac{n}{2} - 1) \lg \lfloor\frac{n}{2}\rfloor + n $$

Note: This problem is solving for Ω regarding divide and conquer algorithms for the recurrence relation below. Solving for big O as the upper bound was straight forward in that T(n) has to be <= a solution of the from T(n) = cnlg(n). You will find CS student math to be a bit sloppy in that we will ignore the floor function and it will disappear.
$$ T(n) = 2T(\frac{n}{2}) + n $$ $$ T(1) = Θ(1) $$ Solving for big O at the upper bound: $$ T(n) \leq 2c \lfloor\frac{n}{2}\rfloor \lg \lfloor\frac{n}{2}\rfloor + n $$ $$ T(n) \leq 2c \frac{n}{2} \lg \frac{n}{2} + n $$ $$ = cn(lg(n) - 1) + n $$ $$ \leq cnlg(n) \: where \: c \geq 1 $$ So, now I'm following a solution that solves for the lower bound Ω. Hence, I'm not able to follow how the solution to which this questions begins.

1

There are 1 best solutions below

1
On

By definition of the floor function, for any natural number $n\geq 2$,

$$ 1\leq\left\lfloor\dfrac{n}{2} \right\rfloor \leq \dfrac{n}{2} < \left\lfloor\dfrac{n}{2} \right\rfloor +1$$

Therefore,

$$\dfrac{n}{2}-1<\left\lfloor\dfrac{n}{2} \right\rfloor $$

Hence assuming $d$ is positive, we have,

$$d \log \left(\left\lfloor\dfrac{n}{2} \right\rfloor\right) \left(\dfrac{n}{2}-1\right) \leq d \log \left(\left\lfloor\dfrac{n}{2} \right\rfloor\right)\left\lfloor\dfrac{n}{2} \right\rfloor $$