Which heap is to be built for ascending sorting and descending sorting. Please explain whether any heap (max or min) could be used for any sorting (ascending or descending).
Normally you will use a max-heap for ascending sorting and a min-heap for descending sorting.
This has to do with the way the heap sort algorithm is normally described:
You can see the algorithm in work in the following graphic: (Created by Gms)
As you can see in each step we put the maximum (first the biggest number, then the second biggest number, ...) at the end of the array and they end up ascendantly sorted.
But obviously you can also use a max-heap to generate a descending sorting. Simply put the found maxima into a new array. (Or simply invert the sorted array at the end.)