How to solve Recurrence Relation using Recursion Tree method for finding min and max using divide and conquer approach?

Viewed 11

I am reading a problem related finding min and max element in an array using the divide and conquer approach. I got stuck in solving the recurrence relation from the recurssive tree method. I have also tried to understand it from "geeks for geeks" website but again I was unable to understand it. The recurrence relation for the problem is -> T(n) = 2T(n/2) + c .

The main question is why we are considering the total cost equation like this

T(n) = c + 2c + 4c + —- + (no. of levels-1) times + last level cost , while summing up the total cost .

Here is the "geeks for geeks" website link-> https://www.geeksforgeeks.org/how-to-solve-time-complexity-recurrence-relations-using-recursion-tree-method/#:~:text=Steps%20to%20solve%20recurrence%20relation,cost%20of%20the%20last%20level

Thank you in advance!

0 Answers
Related