Question: Write a code to check if a binary tree is a min-heap or not Question Write a code to sort an array by using heap

Write a code to check if a binary tree is a min-heap or not Question
Write a code to sort an array by using heap sort algorithm.
I need python code for it.
In Lab Problems Question 1: Implement the HeapPriorityQueue class by implementing following functions. It should follow the min heap property. You can make helper functions if needed. Highlighted functions have only one or two lines of code and NO complex logic required. id Method 1 init (self) Comments Initialize the PriorityQueue Add data into Heap 2 Enqueue (self, key,value) 3 4 Dequeue (self) downheap (self, index) upheap (self, index) min (self) Remove the min value from heap Heapify after removal Heapify after insertion Return the minimum value 5 6 7 getright (self, index) Returns right child 8 Returns left child 9 getleft (self, index) GetParent (self, index) Return the parent len__(self) Returns the size of the Tree 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
