• This stored procedure recursive calls produce a recursion tree structure. Because the issue divides into two subtasks of half original size in each recursive iteration, there are two sub-problems at each level of the tree.
• Assume. That really is, n is a two-digit power. As a result, the recursion finishes at the k th level, as well as the sub-problems' input sizes are reduced to size1 . The supplied method does not display the lines when the input size is 1 .
• As a result, only the lines from level to level are printed .
• Since, each sub problem prints the line only once and there are sub problems at level , the number of times the line is printed at level .
• Add up the total number of characters printed on each level.
As a result, the overall amount of times each line is printed is calculated.
Thus,
Then, for some constant c>0 ,
Also, for some constant ,
Thus, role="math" localid="1658921049129" .
As a result, the software prints a certain amount of lines .
To use the Master’s theorem to solve the recurrence:
To solve the recurrence relation, apply the master theorem (1). Compare and contrast the recurrence relation (1) with both the formula (2).
…… (2)
Then, a=2,b=2 and d=0
Compare d and
Where .
Since , by the third case of master theorem,
Therefore, the number of lines printed by the program is .