sum

1
CS445 — Spring 2006 Brief Class Notes In this course, we will see a few common recursions. Here are some of them, and their solution. The conditions of all of them is T (1) = c, where a and c are constants, and 0 <a< 1. F ormula Solution T (n)= c + T (n - 1) T (n)= O(n) T (n)= cn + T (n - 1) T (n)= O(n 2 ) T (n)= cn + T (n/2)+ T (n/2) T (n)= O(n log n) T (n)= cn + T (an) T (n)= O(n) T (n)= cn + T (an)+ T ((1 - a)n) T (n)= O(n log n) (1)

Upload: taharazvi

Post on 04-Oct-2015

218 views

Category:

Documents


1 download

DESCRIPTION

Algorithms

TRANSCRIPT

  • CS445 Spring 2006Brief Class Notes

    In this course, we will see a few common recursions. Here are some ofthem, and their solution. The conditions of all of them is T (1) = c, where aand c are constants, and 0 < a < 1.

    Formula SolutionT (n) = c + T (n 1) T (n) = O(n)T (n) = cn + T (n 1) T (n) = O(n2)T (n) = cn + T (bn/2c) + T (dn/2e) T (n) = O(n log n)T (n) = cn + T (an) T (n) = O(n)T (n) = cn + T (an) + T ((1 a)n) T (n) = O(n log n)

    (1)