In this recipe, we will learn to arrange some integers in descending order using the heap sort technique.
Arranging numbers in descending order using heap sort
How to do it...
The heap sort method is divided into the following two tasks:
- Creating a max-heap
- Deleting the max-heap
Let's start with creating a max-heap.
Creating a max-heap
The following steps are followed for creating a max-heap:
- The user is asked to enter a number. The number is used to create a heap. The number entered by the user is assigned to an array heap at index location x, where x begins...