Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago

Question

2. Why has the conflict escalated?

Answered: 1 week ago