edited by
877 views
0 0 votes

can you please explain how 1-(1/2)^ln(n)  becomes (n-1)/n ? 

Answer will be $\Theta(n)$
\[
\begin{aligned}
j & =n / 2+n / 4+n / 8+\ldots+1 \\
& =n\left[1 / 2^{1}+1 / 2^{2}+1 / 2^{3}+\ldots+1 / 2^{\lg n}\right]
\end{aligned}
\]
(Sum of first $n$ terms of GP is $\left[a \cdot \frac{1-r^{r}}{1-r}\right]$, where $a$ is the first term, $r$ is the common ratio $<1$, and $n$ is the number of terms)<br /> \[
\begin{array}{l}
=n\left[1 / 2 \frac{1-(1 / 2)^{18 n}}{1-1 / 2}\right] \\
=n\left[\frac{n-1}{n}\right] \Leftarrow \\
=n-1=\Theta(n)
\end{array}
\]

2 Answers

1 1 vote
Here 1/2 is cancel out by 1 - 1/2

$n[1 - (1/2) ^\ log n]$

log property ::   2 ^ log n  (base 2)

                         then replace n with 2

                      = n ^ log 2 = n

So, our equestion are in form ->n[1 - ( 2^(-1) ) ^logn]

 

                        so we can write as n[1 - (n^-1)  ^ log2 ]                                                  then

                         =    $n[ 1- 1/n ]$

                        =   $n[ \frac{n-1}{n} ]$

                         = $ n - 1 $
edited by
Position:
Show:

Related questions

0 0 votes
1 1 answer
829
829 views
KISHALAY DAS asked Oct 19, 2016
829 views
What is the running time for an algorithm which computes the most frequently occurring element of an array $A[1 \ldots n]$ ?$\mathrm{O}(\log \mathrm{n})$$\mathrm{O}(\math...
1 1 vote
1 1 answer
508
508 views
Çșȇ ʛấẗẻ asked Aug 28, 2016
508 views
Let $f(n)=\Omega(n)$ and $g(n)=\Omega\left(n^{2}\right)$. Then $f(n)+g(n)$ is$\quad \Omega(n)$$\theta(n)$$\Omega\left(n^{2}\right)$$\mathrm{O}(n)$
1 1 vote
2 answers 2 answers
641
641 views
Çșȇ ʛấẗẻ asked Aug 28, 2016
641 views
void f(int n){int i, j, k, m;for (i=0; i < 100; i ++){for (j=0; j < n; j++){for (k = 0; k < j; k++)printf("%d", k);}}} What is the worst case running time of the functi...
0 0 votes
2 answers 2 answers
2.2k
2.2k views
venky.victory35 asked Dec 19, 2015
2,174 views
We are given a sequence of $n$ positive numbers $a_{1}, a_{2}, \ldots, a_{n}$ and a fixed number $k>0$. We want to find a pair of numbers $a_{i}$ and $a_{j}$ such that $j...