This preview shows pages 1–5. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Ramesh Yerraballi 71 EE 322C Data Structures Chapter 7:Recursion Sections 7.1, 7.2, 7.3, 7.5 Ramesh Yerraballi 72 Outline Mathematical Induction Recursion Rules of Recursion How it works Examples  Trees, Factorial, Fractal Divide and Conquer Algortihms Revisit MCS sum Analysis of DivideandConquer Algorithms Ramesh Yerraballi 73 What is Recursion A recursive method is a method that directly or indirectly makes a call to itself with a different input GNU is a recursive name!! Recursion in reallife Recursion is a powerful tool but use with caution Recursive code may be hard to debug Mathematical definition of Factorial: 0! = 1 N! = N * (N  1)! Recursive Method : public int fact(int n) { if(n == 0) return 1; else return n * fact(n1); } Ramesh Yerraballi 74 Background: Mathematical Induction Proof by Induction A Statement that holds true for positive integers (natural numbers) Basis Show that the statement is true for some base cases Inductive Hypothesis Assume that the statement is true for some n and then show that it is true for n+1 We will look at a couple of proofs: For any integer N ≥ 1, the sum of the first N integers, given by...
View
Full
Document
This note was uploaded on 09/26/2009 for the course EE 322C taught by Professor Nettles during the Spring '08 term at University of Texas.
 Spring '08
 NETTLES

Click to edit the document details