Presentation is loading. Please wait.

Presentation is loading. Please wait.

Calculate n! Multiply my number by the factorial of the rest of the numbers. if( num > 2 ) return num * factorialR2( num - 1 ); else return 2;

Similar presentations


Presentation on theme: "Calculate n! Multiply my number by the factorial of the rest of the numbers. if( num > 2 ) return num * factorialR2( num - 1 ); else return 2;"— Presentation transcript:

1 Calculate n! Multiply my number by the factorial of the rest of the numbers. if( num > 2 ) return num * factorialR2( num - 1 ); else return 2;

2 Print a string backwards
Print the last character Print the rest of the string backwards System.out.print( str.charAt( str.length() - 1 ) ); if( str.length() > 1 ) reverse( str.substring( 0, str.length() - 1 ) );

3 Binary Search Calculate mid-point of the range
Is the value at mid-point the one you're looking for? If search value < value at mid-point search the low half else search the high half

4 Towers of Hanoi 1. Move n-1 disks from the source to the spare.
2. Move 1 disk from the source to the destination. 3. Move n-1 disks from the spare to the source.

5 Search a directory structure for a file
Loop through the files in this directory If a listing is itself a directory, search that directory


Download ppt "Calculate n! Multiply my number by the factorial of the rest of the numbers. if( num > 2 ) return num * factorialR2( num - 1 ); else return 2;"

Similar presentations


Ads by Google