use of edu.princeton.cs.algs4.In in project AlgorithmsSolutions by Allenskoo856.
the class Ex35 method main.
public static void main(String[] args) {
Graph G = new Graph(new In(args[0]));
Ex35 ex = new Ex35(G);
System.out.println("Is Edge Connected Graph? " + ex.isEdgeConnectedGraph());
}
use of edu.princeton.cs.algs4.In in project AlgorithmsSolutions by Allenskoo856.
the class Selection method main.
public static void main(String[] args) {
String[] a = new In().readAllStrings();
sort(a);
assert isSorted(a);
show(a);
}
use of edu.princeton.cs.algs4.In in project AlgorithmsSolutions by Allenskoo856.
the class Ex18 method main.
public static void main(String[] args) {
String[] a = new In().readAllStrings();
String sort = args[0];
if (sort.equals("selection")) {
Selection.drawSort(a);
} else if (sort.equals("insertion")) {
Insertion.drawSort(a);
}
}
use of edu.princeton.cs.algs4.In in project AlgorithmsSolutions by Allenskoo856.
the class Example method main.
public static void main(String[] args) {
String[] a = new In().readAllStrings();
sort(a);
assert isSorted(a);
show(a);
}
use of edu.princeton.cs.algs4.In in project algorithms-sedgewick-wayne by reneargento.
the class Exercise32_Dictionary method doExperiment.
private void doExperiment() {
LookupCSV lookupCSV = new LookupCSV();
int[] numberOfQueries = { 100000, 1000000, 10000000, 100000000, 1000000000 };
String[] filePaths = { LARGE_INPUT_FILE_PATH1, LARGE_INPUT_FILE_PATH2 };
String[] fileNames = { Constants.SURNAMES_CSV_FILE, Constants.SDSS_CSV_FILE };
StdOut.printf("%18s %20s %10s\n", "Large input | ", "Number of queries | ", "Time spent");
for (int q = 0; q < numberOfQueries.length; q++) {
for (int f = 0; f < filePaths.length; f++) {
In in = new In(filePaths[f]);
String line = in.readLine();
String[] tokens = line.split(",");
int randomKeyIndex = StdRandom.uniform(tokens.length);
int randomValueIndex = StdRandom.uniform(tokens.length);
Stopwatch stopwatch = new Stopwatch();
lookupCSV.lookup(filePaths[f], randomKeyIndex, randomValueIndex, numberOfQueries[q]);
double timeSpent = stopwatch.elapsedTime();
printResults(fileNames[f], numberOfQueries[q], timeSpent);
}
}
}
Aggregations