vb-recursion - CIS 338: Recursion Dr. Ralph D. Westfall...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 338: Recursion Dr. Ralph D. Westfall March, 2009
Background image of page 1

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

View Full DocumentRight Arrow Icon
What Is Recursion? code running itself e.g., a procedure calling itself rather than calling some other procedure or returning control to where it was called
Background image of page 2
What Is Value of Recursion? can make it easier to understand a larger problem if larger problem is doing the same general type of thing repeatedly can sometimes use it to solve a problem with fewer lines of code however requires more memory
Background image of page 3

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

View Full DocumentRight Arrow Icon
Tower of Hanoi famous problem that can be solved with recursion in not many lines of code move all discs from 1 st pin to 2 nd without ever putting a larger disk on top of a smaller one ( video ) can only move 1 disc at a time do this in minimum number of moves code same even with many more discs
Background image of page 4
Recursion Code Example: Calculate Factorial of a Number Function Fact(num as Long ) as Long If num <=1 Then Return 1 Else Return num * Fact(num - 1) End If End Function 'rest of code in notes 'add break, view Call Stack window
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/13/2009 for the course CIS 338 taught by Professor Westfall during the Winter '09 term at Cal Poly Pomona.

Page1 / 10

vb-recursion - CIS 338: Recursion Dr. Ralph D. Westfall...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online