lec11

# lec11 - CSE 20 Lecture 11 Function, Recursion &amp;...

This preview shows pages 1–9. Sign up to view the full content.

1 CSE 20 Lecture 11 Function, Recursion & Analysis (Ch. 6 Shaum’s ) May 3, 2011

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Motivation Complexity of the execution 2 Input x Output y y= Function (x) Recursion
OUTLINE DEFINITION FUNTION RECURSION: CASES ANALYSIS 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 I. Definition A function f: A → B maps elements in domain A to codomain B such that for each a ϵ A, f(a) is exact one element in B. f: A → B A: Domain B: Codomain f(A): range or image of function f(A) B
5 Examples (2) f(x) (1) f(x)=x 2 , x ∈ ℝ (3) f(x) NOT a function

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 (5) NOT a function Examples (4) Mapping from x to y When domain A is an integer set Z, we may denote f(x) as f x , ie. f 0 , f 1 , f 2 .
7 Case of Recursion Fibonacci Sequence Index: 0 1 2 3 4 5 6 Sequence: 0 1 1 2 3 5 8 0 1 n n-1 2 f =0, f =1, f =f +f 1 n n - 2200

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8 Another Case of Recursion: Ackermann Function Ackermann Function: A(m,n), m, n N 1) m=0: A(0,n)=n+1 2) m≠0, n=0: A(m,0)=A(m-1,1) 3) m≠0, n≠0: A(m,n)=A(m-1, A(m,n- 1)) Example: A(1,1)= A(0, A(1,0)) =A(0,2) A(2,0) =A(1,1)
This is the end of the preview. Sign up to access the rest of the document.

## lec11 - CSE 20 Lecture 11 Function, Recursion &amp;...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online