10-25 Class Notes CS 107

10-25 Class Notes CS 107 - 10-25 Class Notes CS 107 Monday,...

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

View Full Document Right Arrow Icon
time. The in-class portion has been delayed from Friday until Monday, a week from today. Announcements: Questions? To sort an integer array called values you can use: Arrays.sort( values); // thanks to Mike (very long last name) // you may need to import java.util.Arrays (or something like that) You can use this in your program! Last Time: We started discussion the intuition for recursion Today: More intuition on recursion; Samples of recursive code Intuition for Recursion See course web page at: http://logos.cs.uic.edu/Examples%20And%20Notes/notes/Java/Recursion/Recursion.htm // Find the factorial of a non-negative integer x private int factorial( int x) } return answer; { int answer = 1; for (int i=x; i>0; i--) { answer = answer * i; } Consider this simple method to define factorial: Pasted from < http://logos.cs.uic.edu/Examples%20And%20Notes/notes/Java/Recursion/Recursion.htm > And two approaches using recursion. The first makes multiple "copies" of the same method. The second uses the
Background image of page 1

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

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

Page1 / 6

10-25 Class Notes CS 107 - 10-25 Class Notes CS 107 Monday,...

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

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