-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ab5290
commit f0dddc2
Showing
8 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ClassProblems.Class3; | ||
|
||
import java.math.BigInteger;/** | ||
* Rutabega | ||
*/ | ||
public class Rutabega { | ||
|
||
public static BigInteger fun(BigInteger index) { | ||
return index.add(new BigInteger("1")); | ||
|
||
} | ||
public static void main(String[] args) { | ||
BigInteger result = Rutabega.fun(new BigInteger("9223372036854775807")); | ||
System.out.println(result); | ||
|
||
// System.out.println(Rutabega.fun("1")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ClassProblems.Class3; | ||
|
||
/** | ||
* fib0 | ||
*/ | ||
public class fib0 { | ||
|
||
private static long[] f = new long[92]; | ||
|
||
public static long fib(int n){ | ||
if (n == 0) | ||
return 0; | ||
if (n == 1) | ||
return 1; | ||
if (f[n] > 0) | ||
return f[n]; | ||
|
||
f[n] = fib(n-1) + fib(n-2); | ||
return f[n]; | ||
} | ||
public static void main(String[] args) { | ||
System.out.println(fib(5)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ClassProblems.Class3; | ||
|
||
import java.math.BigInteger; | ||
|
||
/** | ||
* runRutabega | ||
*/ | ||
public class runRutabega { | ||
|
||
public static void main(String[] args) { | ||
BigInteger result = Rutabega.fun(new BigInteger("21421421")); | ||
System.out.println(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
public class whatever{ | ||
// public static long fun(int index) { | ||
// if (index == 1 ) return 1l; | ||
// else if (index == 2) return 2l; | ||
// else return fun(index-1) + fun(index-2); | ||
|
||
public static long fun(int index, long a, long b) { | ||
if (index == 0 ) return b; | ||
else return fun(index-1, b, a+b); //accumulated passing style | ||
//homework01 using BigIntegers | ||
} | ||
public static void main(String[] args) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package Homework; | ||
import java.util.Dictionary; | ||
|
||
|
||
public class Homework01 { | ||
Dictionary d = new Dictionary(); | ||
public static int fib(int n) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters