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:

  equation32907

Table gif shows 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_inline67840 tex2html_wrap_inline67870
Program gif T(n)=2T(n/2)+O(1) 2 2 0 tex2html_wrap_inline67826 tex2html_wrap_inline67876
Program gif T(n)=2T(n/2)+O(n) 2 2 1 tex2html_wrap_inline67840 tex2html_wrap_inline67882
Table: Computing running times using Equation gif.


next up previous contents index

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