Is it true that $\sum_{i=1}^n a_i ( i b_{i} -(i-1) b_{i-1}) \in O(\log n)$?

29 Views Asked by At

Define $$ V(n) = \sum_{i=1}^n a_i (i \times b_{i} - (i-1) \times b_{i-1}) $$ given that

  • $a_i \leq A$, where $A$ is a constant.

  • $b_i \leq i$

  • $\sum_{i=1}^n b_i = n $

  • $b_0 = 0$

Is it true that $V(n) \in O(\log n)$? How about $V(n) \in O(n)$?

Side note: $O(.)$ is the big-Oh notation, meaning that we don't care about constants; what matters is the growth in terms of the target variable $n$.

1

There are 1 best solutions below

1
On BEST ANSWER

I assume here all $a_i,b_i$ are non-negative.

Unfortunately, $V(n) = O(\log n)$ is not true in general, and neither is $O(n)$. As a counterexample, assume for convenience $n=2m$ is even,and take $$ a_{2i-1} = 0,\qquad a_{2i} = A $$ and $$ b_{2i-1} = 0,\qquad b_{2i} = 2 $$ for all $1\leq i \leq m$. This leads to $\sum_{i=1}^n b_i = \sum_{i=1}^m b_{2i} = 2m = n$, and indeed $b_i \leq i$ for all $1\leq i\leq n$ as desired. But now, by construction only the terms with even indices remain in the sum defining $V(n)$ (since $a_{i}=0$ for odd $i$'s), and

$$ V(n) = A\sum_{i=1}^{m} (2i\underbrace{b_{2i}}_{=2}-\underbrace{(2i-1)b_{2i-1}}_{=0}) = A\sum_{i=1}^{m} 4i = 4A\frac{m(m+1)}{2} = \Theta(m^2)= \Theta(n^2). $$