mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 17:29:31 +08:00
Merge pull request #137 from daniel-mueller/coding-style-fixes
turned some public methods private
This commit is contained in:
@ -11,7 +11,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class Fibonacci {
|
public class Fibonacci {
|
||||||
|
|
||||||
public static Map<Integer,Integer> map = new HashMap<Integer,Integer>();
|
private static Map<Integer,Integer> map = new HashMap<Integer,Integer>();
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ public class Fibonacci {
|
|||||||
* Outputs the nth fibonacci number
|
* Outputs the nth fibonacci number
|
||||||
**/
|
**/
|
||||||
|
|
||||||
public static int fibMemo(int n) {
|
private static int fibMemo(int n) {
|
||||||
if (map.containsKey(n)) {
|
if (map.containsKey(n)) {
|
||||||
return map.get(n);
|
return map.get(n);
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ public class Fibonacci {
|
|||||||
* Outputs the nth fibonacci number
|
* Outputs the nth fibonacci number
|
||||||
**/
|
**/
|
||||||
|
|
||||||
public static int fibBotUp(int n) {
|
private static int fibBotUp(int n) {
|
||||||
|
|
||||||
Map<Integer,Integer> fib = new HashMap<Integer,Integer>();
|
Map<Integer,Integer> fib = new HashMap<Integer,Integer>();
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class Levenshtein_distance{
|
public class Levenshtein_distance{
|
||||||
private int minimum(int a, int b, int c){
|
private static int minimum(int a, int b, int c){
|
||||||
if(a < b && a < c){
|
if(a < b && a < c){
|
||||||
return a;
|
return a;
|
||||||
}else if(b < a && b < c){
|
}else if(b < a && b < c){
|
||||||
@ -16,7 +16,7 @@ public class Levenshtein_distance{
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int calculate_distance(String a, String b){
|
private static int calculate_distance(String a, String b){
|
||||||
len_a = a.length() + 1;
|
len_a = a.length() + 1;
|
||||||
len_b = b.length() + 1;
|
len_b = b.length() + 1;
|
||||||
int [][] distance_mat = new int[len_a][len_b];
|
int [][] distance_mat = new int[len_a][len_b];
|
||||||
|
@ -31,7 +31,7 @@ public class LongestIncreasingSubsequence {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int LIS(int[] array) {
|
private static int LIS(int[] array) {
|
||||||
int N = array.length;
|
int N = array.length;
|
||||||
if (N == 0)
|
if (N == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user