1 votes
1 votes

suppose you are given n bit integers asuming for common sense n as power of 2 .it is required to multiply them using divide and conquer method .what is the divide and conquer recurrence that would arise for the problem

a) T(n)=4T(n/2)+c      

b) a) T(n)=2T(n/2)+n              

c) a) T(n)=4T(n/2)+n2          

d) a) T(n)=4T(n)+n

2 Answers

1 votes
1 votes
$T(n)=T(\frac{n}{2})+n$

$\rightarrow T(n)=T(\frac{n}{4})+\frac{3n}{4}$

$\rightarrow T(n)=T(\frac{n}{2^k})+\frac{(2^{k}-1)n}{2^{k-1}} $ – Equation 1

For $T(1)=1, \frac{n}{2^k}=1$

$\rightarrow n=2^k \rightarrow k = logn$

Putting value of $k$ in Equation 1

$T(n)=1+ \frac{(2^{logn} -1)n}{2^{logn -1}}$

Identity: $c^{log_cx}=x$, therefore

$T(n)=1+\frac{(n-1)n}{\frac{n}{2}}\rightarrow T(n)=1+2(n-1)$

Constants are ignored, $T(n)=O(n)$

Related questions

3 votes
3 votes
1 answer
2
1 votes
1 votes
1 answer
3
ItzDc asked Jun 3, 2022
3,023 views
I can't figure out how to proceed and which case it's falling under after calculating h(n)
4 votes
4 votes
2 answers
4
Deep99 asked Jun 18, 2016
34,927 views