import javafoundations.LinkedQueue; //for use of a Queue implementation import javafoundations.Queue; import java.util.Vector; import java.util.Scanner; import java.io.File; import java.io.IOException; /** * RadixSort.java Implements Radix sort for base-10, proper integers, each * of the same defined length. * * @author CS230 staff (SK) * @version Fall 2020 * */ public class RadixSort { //instance variables private final int NUMLENGTH = 3; //length of each number in input private final int BASE = 10; //number system we are working on private Vector input; //to hold the input ints private Vector workingVec; //holds the Strings during processing private Vector output; //holds final sorted ints /** * constructor * This version just hardwires a few numbers for input * */ public RadixSort(String inF) { //create vectors to hold the input and output input = new Vector(); readInput(inF); workingVec = new Vector(); output = new Vector(); //copy input ints into output Vector as strings for (int i=0; i> qs; //create a vector of the needed queues: as many as the digits //in the system we are working in. Each one starts out empty. qs = new Vector>(); for (int i=0; i()); } //for each str in the working vector for (int i = 0; i < workingVec.size(); i++) { currentStr = workingVec.get(i); //get its character at input position 'pos' currentChar = currentStr.charAt(pos); // convert that char into an int currentDigit = Character.getNumericValue(currentChar); //use this int as an index into the vector of queues, //to enqueue the currentStr qs.get(currentDigit).enqueue(currentStr); } //empty each one of the queues into the output vector Queue currentQ; //temporary variable //empty output vector each time you sort on a digit workingVec = new Vector(); for (int i=0; i=0; i--) { processOnePosition(i); } //fill in the final output vector with the sorted numbers for (int i=0; i