It must be minus of logbase2N in last term?

In this, sanket bhaiya made the remaining term after GP as +h/2^(h-1) but it must be minus of it as we are subtracting eqn 1 from eqn 2?? Am I right. So, the last term must be S=n-2-logbase2n instead of what sanket bhaiya written??

Hello @subham221,

Yes, you have pointed out the correct mistake.
But the complexity would be same irrespective of the sign.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.