# Ch7 - Ramesh Yerraballi 7-1 EE 322C Data Structures Chapter...

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 Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Ramesh Yerraballi 7-1 EE 322C Data Structures Chapter 7:Recursion Sections 7.1, 7.2, 7.3, 7.5 Ramesh Yerraballi 7-2 Outline Mathematical Induction Recursion Rules of Recursion How it works Examples - Trees, Factorial, Fractal Divide and Conquer Algortihms Revisit MCS sum Analysis of Divide-and-Conquer Algorithms Ramesh Yerraballi 7-3 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 real-life 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(n-1); } Ramesh Yerraballi 7-4 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.

### Page1 / 16

Ch7 - Ramesh Yerraballi 7-1 EE 322C Data Structures Chapter...

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

View Full Document
Ask a homework question - tutors are online