Question: In this project, you will use radix.txt as the input file, and output the integers SORTED USING RADIX SORT. Your main program will input the

In this project, you will use radix.txt as the input file, and output the integers SORTED USING RADIX SORT.

Your main program will input the integers and put them into a QUEUE. It will then pass this queue to a method called radixSort which will sort the numbers in the queue, passing the sorted queue back to main.

The main program will then call another method to print the contents of this (sorted queue) .

This is what I have so far:

public static void main(String[] args) { File inFile=new File("radix.txt"); Scanner scnr=null; //Try/Catch try{ scnr=new Scanner(inFile); } catch(FileNotFoundException e){ } String temp = null; String[] fileStrings = new String[25]; createArray(fileStrings); Queue myQueue = new LinkedList<>(); for (int i=0; i< fileStrings.length;i++){ myQueue.add(fileStrings[i]); } System.out.println("Max Digits:"+getLength(fileStrings)); } public static void createArray (String[]nums){ File inFile=new File("radix.txt"); Scanner scnr=null; //Try/Catch try{ scnr=new Scanner(inFile); } catch(FileNotFoundException e){ } String temp = null; int count = 0; while (scnr.hasNext()){ temp = scnr.next(); nums[count] = temp; System.out.println(nums[count]); count++; } }

public static int getLength(String[]nums){ int i, j; int max = 0; int count = 0; int size = nums.length; String s = null; for (i=0; i

if (s.length() > max){ max = s.length(); } } } return max; }

Need help creating the radix sort using an array of queues. Please help.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!