CS 350 Algorithms and Complexity - Computer Action Team
[Pages:65]CS 350 Algorithms and Complexity
Winter 2019
Lecture 4: Analyzing Recursive Algorithms
Andrew P. Black
Department of Computer Science Portland State University
General Plan for Analysis of Recursive algorithms
Decide on parameter n indicating input size
Identify algorithm's basic operation
Determine worst, average, and best cases
for input of size n
Set up a recurrence relation, with initial
condition, for the number of times the basic operation is executed
Solve the recurrence, or at least ascertain the order of growth of the solution (see Levitin Appendix B)
2
Ex 2.4, Problem 1(a)
! Use a piece of paper and do this now, individually.
" Solve this recurrence relation:
x(n) = x(n 1) + 5 for n > 1 x(1) = 0
3
Individual Problem (Q1):
Solve the recurrence x(n) = x(n1) + 5 for n > 1 x(1) = 0
What's the answer?
4
Individual Problem (Q1):
Solve the recurrence x(n) = x(n1) + 5 for n > 1 x(1) = 0
What's the answer?
A. x(n) = n1 B. x(n) = 5n C. x(n) = 5n5 D. None of the above
5
My Solution
x(n) = x(n 1) + 5 for all n > 1 x(1) = 0
6
My Solution
x(n) = x(n 1) + 5 for all n > 1 x(1) = 0 replace n by n-1:
6
My Solution
x(n) = x(n 1) + 5 for all n > 1
x(1) = 0
replace n by n-1:
x(n 1) = x(n 2) + 5
6
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- the discrete fourier transform
- ece 302 lecture 5 1 joint pdf and cdf
- math 401 notes sequences of functions pointwise and
- 1 review of probability columbia university
- exponential distribution
- legendre polynomials and functions
- jiwen he 1 1 geometric series and variations
- chap 5 joint probability distributions
- math 461 fourier series and boundary value problems
- cs 350 algorithms and complexity computer action team
Related searches
- turn key 350 engine and transmission packages
- fact and opinion computer games
- axis and allies computer game
- freud and cs lewis
- plug and play computer camera
- 350 crate engine and transmission
- advantages and disadvantages computer network
- chevy 350 pistons and rods
- 350 motor and transmission combos
- 350 motor and transmission
- black and white computer wallpaper
- searching sorting and complexity analysis