In my_func(a)
, Recurrence Relation will be
$T(n) = \begin{cases} 4T\bigg(\frac{n}{2}\bigg)+{n} & \quad \text{if } n \geq 4\\ 1 & \quad \text{if } n <4 \end{cases} $
In new_func(a)
, Recurrence Relation will be
$T(n) = \begin{cases} 3T\bigg(\frac{n}{2}\bigg)+{n} & \quad \text{if } n \geq 4\\ 1 & \quad \text{if } n <4 \end{cases} $
You can solve Both of these Recurrence Relations using Master TheoremMaster Theorem as explained in link.
The Time Complexity of my_func(a)
will be $\theta(n^2)$ since $\log_24 = 2$
The Time Complexity of new_func(a)
will be $\theta(n^{1.5849})$ since $\log_23 = 1.5849$
You can solve both of these questions by Substitution Method, which is Time Consuming. One of the Example using this method is attached.
The new_func(a)
will be slower than Merge Sort
, and faster than my_func(a)
.