第1个回答 2015-07-10
import java.util.Random;
public class Test {
private int[] num = new int[20];
private int idx = 0;
public void push(int n) {
if (idx < 20)
num[idx++] = n;
}
public boolean hasExist(int n) {
for (int i = 0; i < idx; i++)
if (num[i] == n)
return true;
return false;
}
public int size() {
return idx;
}
public void print() {
for (int i = 0; i < idx; i++)
System.out.print(num[i] + " ");
System.out.print("\n");
}
public static void main(String[] args) {
Test t = new Test();
while (t.size() < 20) {
Random r = new Random();
int n = r.nextInt(101);
if (!t.hasExist(n))
t.push(n);
}
t.print();
}
}
第2个回答 2015-07-29
/**
* If the given graphs are isomorphic, returns a map between the vertex sets witnessing the isomorphism. If
* the given graphs are not isomorphic, returns null.
* @param a
* @param b
* @return
*/
public static Map<String, String> getIsomorphicMap(UndirectedGraph<String, DefaultEdge> a, UndirectedGraph<String, DefaultEdge> b) {
}