Question: Q5: [Marks 3] Propose an algorithm and write python code (iterative and NOT recursive) that checks if a given array is a max-heap or not.

 Q5: [Marks 3] Propose an algorithm and write python code (iterative

Q5: [Marks 3] Propose an algorithm and write python code (iterative and NOT recursive) that checks if a given array is a max-heap or not. User enters an array and heap size and your program returns either True or False. The input to the program will be given as shown below with the elements of the array separated by a space. Clearly mention any assumptions as a comment in your program. Sample Run of the program: Enter the array to test: 16 14 10 8 7 9 3 2 4 1 0 20 Enter heap size: 10 True

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!