Question: PLEASE HELP IN JAVA: In this project, you will use radix.txt as the input file, and output the integers SORTED USING RADIX SORT. Your main
PLEASE HELP IN JAVA:
In this project, you will use radix.txt as the input file, and output the integers SORTED USING RADIX SORT.
Your main program will generate 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) . Like this: myQ.print();
Notes:
1. radixSort method will need an array of queues.
2. radixSort will NOT print the queue.
3. Please use your Queue class (the one with nodes). You will need to add a print method to your Queue class because your main program cannot access a node. This is the only additional method you will need in Queue.
What I have so far:
public static class Node { Object item; Node next; Node(Object newItem) { item = newItem; next=null; } Node(Object newItem, Node nextNode) { item = newItem; next=nextNode; } //queue class public class Queue
public int size(){ if (size==0){ } return size; } public T peek(){ return (T) head.item; //return item } public boolean isEmpty() { return (size==0); } } //print in queue class public void print(){ } }
public static void main(String[] args) { //Input File Scanner fileInput = null; //Try Catch File inFile = new File("Radix.txt"); try { fileInput = new Scanner(inFile); } catch (FileNotFoundException ex) { } myQ.print(); } public void radixSort(){ } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
