Logo Data Structures and Algorithms with Object-Oriented Design Patterns in C++
next up previous contents index

Summary

For many divide-and-conquer algorithms the running time is given by the general recurrence shown in Equation gif. Solutions to the recurrence depend on the relative values of the constants a, b and k. Specifically, the solutions satisfy the following bounds:

  equation33113

Table gif how to apply Equation gif to find the running times of the divide-and-conquer algorithms described in the preceding sections. Comparing the solutions in Table gif with those given in Table gif shows the results obtained using the general formula agree with the analyses done in the preceding sections.

 

 

program recurrence a b k case solution
Program gif T(n)=T(n/2)+O(1) 1 2 0 tex2html_wrap_inline68839 tex2html_wrap_inline68869
Program gif T(n)=2T(n/2)+O(1) 2 2 0 tex2html_wrap_inline68825 tex2html_wrap_inline68875
Program gif T(n)=2T(n/2)+O(n) 2 2 1 tex2html_wrap_inline68839 tex2html_wrap_inline68881
Table: Computing Running Times using Equation gif


next up previous contents index

Bruno Copyright © 1997 by Bruno R. Preiss, P.Eng. All rights reserved.