Java BASICS (2) and java Basics
1. absolute path/relative path
1> complete absolute path URL
2> the relative path/starting with "/" indicates the entire web project.
3> relative paths not starting with "/"./indicates the current path./indicates the upper path.
Two-thread status
New ready for execution blocking death
Algorithm Analysis
There are n floors of stairs and a maximum of m floors in each step. How many crawling methods are there?
Analysis: one layer of stairs, one method of crawling, two types of three layers, three types of four layers, namely f (n) = f (n-1) + f (n-2) + f (n-3) + .. + f (0)
At most m layers, f (n) = f (n-1) + f (n-2) + f (n-3) +... + f (n-m) is recursive.
The following are core algorithm programs:
Public int getMethodCount (int n, int m ){
If (0 = n ){
Return 1; // The number of steps is 0.
} Else if (1 = total ){
Return 1; // The number of steps is 1.
} Else {
Int result = 0;
For (int I = 0; I <= n; I ++ ){
If (I <= m ){
Result + = getMethodCount (n-I, m );
}
}
Return result;
}
}
4. list all the combinations of numbers in an array, for example, 1 and 2, and 1, 2, 12, and 21.
The complete code is as follows:
Public static void main (String [] args ){
String [] array = new String [] {"1", "2 "};
ListAll (Arrays. asList (array ),"");
}
Public static void listAll (List ca, String p) {90
System. out. println (p );
For (int I = 0; I <ca. size (); I ++ ){
List temp = new Alibaba List (ca );
ListAll (temp, p + temp. remove (I ));
}
}