Question: HEAP SORT: Can you please give the algorithm for heap sort which will also count any movement and comparisons in JAVA please. Please show test

HEAP SORT: Can you please give the algorithm for heap sort which will also count any movement and comparisons in JAVA please.

Please show test cases with an in order, reverse order, and random arrays.

These are the test cases I am using

void inOrderSort() { for(int i =0; i < size; i++) { inOrder[i] = i + 1; } } void randOrderSort() { Random rand = new Random(); for (int index = 0; index < size; index++) randomOrder[index] = (Math.abs(rand.nextInt()) % 100); } void revOrderSort() { for(int i=0; i

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!