use of edu.princeton.cs.algs4.In in project algorithms-sedgewick-wayne by reneargento.
the class Exercise17 method readAllTransactions.
public static Transaction[] readAllTransactions(String fileName) {
In in = new In(fileName);
Queue<Transaction> queue = new Queue<>();
while (!in.isEmpty()) {
queue.enqueue(new Transaction(in.readLine()));
}
int queueSize = queue.size();
Transaction[] transactions = new Transaction[queueSize];
for (int i = 0; i < queueSize; i++) {
transactions[i] = queue.dequeue();
}
return transactions;
}
use of edu.princeton.cs.algs4.In in project algorithms-sedgewick-wayne by reneargento.
the class Exercise8 method main.
public static void main(String[] args) {
In in = new In(args[0]);
int[] values = in.readAllInts();
StdOut.println(countEqualNumbers(values));
}
use of edu.princeton.cs.algs4.In in project algorithms-sedgewick-wayne by reneargento.
the class Exercise2 method main.
public static void main(String[] args) {
In in = new In(args[0]);
int[] array = in.readAllInts();
StdOut.println(count(array));
}
Aggregations