write a little program which provide full working implementa

write a little program which provide full working implementation of maximum-ordered (i.e. returning the current max value) priority queue MaxPQ3 implemented as a ternary heap-sorted tree. Modify all the methods that you need to, and submit your class complete with the main) method that performs some testing (i.e. inserts some data into your priority queue, retrieves and prints the max, then inserts few more, extract and print the max again - it is up to you to build the test case).

Solution

void max_heapify (int Arr[ ], int i, int N) { int left = 2*i //left child int right = 2*i +1 //right child if(left<= N and Arr[left] > Arr[i] ) largest = left; else largest = i; if(right <= N and Arr[right] > Arr[largest] ) largest = right; if(largest != i ) { swap (Ar[i] , Arr[largest]); max_heapify (Arr, largest,N); } }
write a little program which provide full working implementation of maximum-ordered (i.e. returning the current max value) priority queue MaxPQ3 implemented as

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site