Answered step by step
Verified Expert Solution
Question
1 Approved Answer
?IN JAVA QUESTION: 10.3 A 2-3-4 tree can be used as a sorting machine. Write a sort() method thats passed an array of key values
?IN JAVA
QUESTION:
10.3 A 2-3-4 tree can be used as a sorting machine. Write a sort() method thats passed an array of key values from main() and writes them back to the array in sorted order.
?IN THIS PROGRAME PLEASE USE THIS MAIN METHOD..
OUTPUT:
Please make sure it work..Please do it as soon as possible. Thanks...
In the Tree234 you may add fields: longll sortArray; int sortlndex; // ref to array for sort // index into sortArray and methods sort(longl] arr, int size) and recSort(Node thisNode) public static void main(Stringl) args) Tree234 theTree new Tree2340) int size 20; longl] theArray (100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 5, 15, 25, 35, 45, 55, 65, 75, 85,95 System.out.println("Unsorted:"); for(int j-0; jksize; jt+) System.out.print( theArrayil+" System.out.println("); theTree.sort(theArray, size); //sort the array System.out.println("Sorted:")Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started