The bottom level has n nodes, each contributing a cost of c, for a total cost of cn. The idea is to divide the array into two subsets — sorted subset and unsorted subset.
How should we choose k in practice? Exercises 2. We do not need the master theorem to intuitively understand why the solution to the recurrence 2. Because we are assuming that the input size is a power of 2, the next input size to consider is 2iC1. We continue expanding each node in the tree by breaking it into its constituent parts as determined by the recurrence, until the problem sizes get down to 1, each with a cost of c.
The fully expanded tree in part d has lgn C 1 levels i. Now assume as an inductive hypothesis that the number of levels of a recursion tree with 2i leaves is lg 2i C 1 D i C 1 since for any value of iwe have that lg 2i D i.
The total number of levels of the recursion tree in Figure 2.