In Java code implement the HeapSort algorithm Your function
In Java code, implement the HeapSort algorithm. Your function must take an ArrayList as input and output a sorted ArrayList.
Solution
Please find the required program along with its output. Please see the comments against each line to understand the step.
-----------------------------------------------------------------------------------
OUTPUT:
ArrayList elements before sorting:
4 3 8 0 6 1
ArrayList elements after sorting:
0 1 3 4 6 8
