Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f9dfe5f

Browse files
committed
CHORE Refactored source files
1 parent 6e10fb4 commit f9dfe5f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎src/PracticeAlgorithms.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public static long Fib(int N) {
1616
return Fib(N - 2) + Fib(N - 1);
1717
}
1818

19+
1920
// dynamic programming and memoization
2021
public static long FastFib(int N, HashMap<Integer, Long> cache) {
2122
if (N == 0) {
@@ -38,6 +39,7 @@ public static boolean isBetweenZeroAndOne(double x, double y) {
3839
return (0 < x && x < 1) && (0 < y && y < 1);
3940
}
4041

42+
4143
/**
4244
* static method to return the binary string representation of an integer
4345
* */
@@ -48,6 +50,7 @@ public static String toBinaryString(int x) {
4850
return binaryString.toString();
4951
}
5052

53+
5154
/**
5255
* static recursive method that "builds" the binary string
5356
* */
@@ -57,6 +60,7 @@ private static String binaryFormString(int x, String binString) {
5760
return binaryFormString(x / 2, binString) + (x % 2);
5861
}
5962

63+
6064
/**
6165
* static method to print a "*" or " " depending on the contents in a two-dimensional array
6266
* */
@@ -73,6 +77,7 @@ public static void printTwoDmBooleanArray(boolean[][] theArray) {
7377
}
7478
}
7579

80+
7681
/**
7782
* static method to print the formatted contents of a two-dimensional int array
7883
* */
@@ -86,6 +91,7 @@ public static void printTwoDmIntArray(int[][] theArray) {
8691
}
8792
}
8893

94+
8995
/**
9096
* static method that returns the transposition of an input matrix
9197
* */
@@ -104,6 +110,7 @@ public static int[][] matrixTransposition(int[][] theMatrix) {
104110
return transposedMatrix;
105111
}
106112

113+
107114
/**
108115
* recursive method that returns the greatest integer not greater than log(N)
109116
* to base two
@@ -114,6 +121,7 @@ public static int lg(int N) {
114121
return 1 + lg(N / 2);
115122
}
116123

124+
117125
public static void main(String[] args) {
118126
Random generator = new Random();
119127
HashMap<Integer, Long> cache = new HashMap<>();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /