library(network)
m <- matrix(rbinom(1000,1,.4),15,5)
diag(m) <- 0
g <- network(m, directed=FALSE)
summary(g)
plot(g)
Tag Archives: Algorithm
Simple Java Insertion Sort
package insertionshort; public class InsertionShort { public static void main(String[] args) { int[] a = {123, 235, 23, 46, 34, 2, 45, 235, 25, 65, 46, 2345, 25, 246, 24, 5246, 24, 6}; intInsertionSort(a); } public static void intInsertionSort(int[] a) { for (int i = 0; i < a.length; i++) { int temp = a[i]; int j; for (j = i - 1; j >= 0 && temp < a[j]; j--) { a[j + 1] = a[j]; } a[j + 1] = temp; for (int f = 0; f < a.length; f++) { System.out.print(a[f] + "\t"); } System.out.println(); } } }