Question: * * if ( temp < heap [ child ] ) { heap [ i ] = heap [ child ] ; } else break;
iftemp heapchild heapi heapchild; else break; i child; heapi temp; private int maxChildint i int leftChild kthChildi; int rightChild kthChildi; return heapleftChildheaprightChildleftChild:rightChild;
The Ternary operation shown above is from the method shown below, please help convert this ternary operation into a if and else statement. I Have been stuck on this for a few days know on how to do this, with out destroying the logic, that then breaks my code.
private void heapifyDownint i
int child;
int temp heapi;
whilekthChildi heapSize
child maxChildi;
iftemp heapchild heapi heapchild; else break; i child; heapi temp; private int maxChildint i int leftChild kthChildi; int rightChild kthChildi; return heapleftChildheaprightChildleftChild:rightChild;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
