Question: Is this correct? / * * * Return the largest key on the priority queue. * Throw an exception if the priority queue is empty.

Is this correct?

Is this correct? / * * * Return the largest key
/ * * * Return the largest key on the priority queue. * Throw an exception if the priority queue is empty. * public Integer max( ) { if (root == null) { throw new RuntimeException ("Priority queue is empty") ; return root . data; /** Add a new key to the priority queue. */ public void insert(Integer x) { Node newNode = new Node (x) ; root = insert (root, newNode) ; swim (newNode ) ; / / Create a new Node n with value x / / Insert it at the end of the tree / / swim(n) ; return

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 Accounting Questions!