Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import edu.princeton.cs.algs4.StdIn;
- import edu.princeton.cs.algs4.StdOut;
- public class Permutation {
- public static void main(String[] args) {
- RandomizedQueue<String> q = new RandomizedQueue<String>();
- int k = Integer.parseInt(args[0]);
- while (!StdIn.isEmpty()) {
- String s = StdIn.readString();
- q.enqueue(s);
- }
- for (int i = 0; i < k; i++) {
- StdOut.print(q.dequeue() + "\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement