![JAR search and dependency download from the Maven repository](/logo.png)
learn.week2.Permutation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of algorithm Show documentation
Show all versions of algorithm Show documentation
Simple implementation of basic algorithm.
The newest version!
package com.mazhangjing.algorithm.learn.week2;
import edu.princeton.cs.algs4.StdIn;
public class Permutation {
public static void main(String[] args) {
//System.out.println(Arrays.asList(args));
int k = Integer.parseInt(args[0]);
RandomizedQueue queue = new RandomizedQueue<>();
while (!StdIn.isEmpty()) {
String input = StdIn.readString();
queue.enqueue(input);
}
for (int i = 0; i < k; i++) {
System.out.println(queue.dequeue());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy