Write a heap method named incrementpriority that given the


Problem

(a) List all structures that are both heaps and binary search trees. Assume that all elements of the structures have different values.

(b) Use the linear-time heap creation algorithm to create a heap out of the following keys: 10 12 1 14 6 5

(c) Consider that you have a class named Heap that preserves a heap of integers using an array of int - "elements" and an int variable named "count". Write a Heap method named isCorrect to check that the heap is correctly built.

(d) Write a Heap method named incrementPriority that, given the position of an element in the array just described, adds 1 to its value and reorganizes the heap if necessary. The reorganization should require no more than O(log n) operations, where n is the current number of heap elements.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a heap method named incrementpriority that given the
Reference No:- TGS02779550

Expected delivery within 24 Hours