Task Implement Heap Contiguous List Use Heapsort List Data Structure Use Array Store List Q37274631

Task: Implement a heap as a contiguous list and then useheapsort on the list.

Data Structure: Use an array to store the list.However, do not use the built-in STL functions fora heap — i.e., do not use make_heap( ),push_heap( ), pop_heap( ), or sort_heap( ).

Processing: Do the following operations:

  • Fill an array with unordered integers, from theC162P10heaplist.txt file. You may assume that the inputlist has no duplicate entries.
  • Convert the original list into a heap using Nyhoff’sheapify algorithm.
  • Sort the heap with a heapsort.

Output: Print the list 3times

  • after the initial load
  • after converting to a heap
  • after sorting

          Theoutput may go to the screen.

C162P10heaplist.txt:  

           72, 85, 9,

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.