Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm supposed to make a Radix Sort using a queue and this is what I have: RadixSort Class: public class RadixSort { int[] array={304,319,819,1420,9201,1212,4102,8196,1076,1331,1471,2193,1055}; Queue[]

I'm supposed to make a Radix Sort using a queue and this is what I have:

RadixSort Class:

public class RadixSort { int[] array={304,319,819,1420,9201,1212,4102,8196,1076,1331,1471,2193,1055}; Queue[] digits=new Queue[13]; public RadixSort(){ System.out.println("Unsorted array:"); printArray(); for(int i=0;i

Queue Class:

public class Queue{ private int[] array; private int Max; private int front, rear, count=0;

public Queue(int size){ Max=size; front=rear=0; count=0; array=new int[size]; } public int getSize() { return count; }

public boolean isEmpty(){ return count==0; } public void enque(int a){ if(count+1<=Max){ array[rear]=a; rear++; count--; System.out.println(a + " Was added to the rear"); } else{ System.out.println("Queue Full"); } } public void deque(){ if(count>0){ System.out.println(array[front] + " Was removed from the front"); array[front]=-1; front++; count--; } else{ System.out.println("Queue empty"); } } public int getFront(){ return front; } public void display(){ System.out.println("Queue: "); for (int i=0;i

This is the output:

Unsorted array: 249 219 789 110 911 112 518 816 176 167 671 233 455 9 249 Was added to the rear 9 219 Was added to the rear 9 789 Was added to the rear 0 Queue Full 1 911 Was added to the rear 2 112 Was added to the rear 8 518 Was added to the rear 6 816 Was added to the rear 6 176 Was added to the rear 7 167 Was added to the rear 1

Can someone explain the problem?

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

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions

Question

How does DaaS change the way data is handled?

Answered: 1 week ago