int maxDia = Integer.MINVALUE;

int postOrder ( int[] tree , int index ) {

```
if(index > tree.length -1)
return 0;
int maxLeftBranch = postOrder(tree,index*2);
int maxRightBranch = postOrder(tree,index*2 + 1);
int dia = maxLeftBranch + maxRightBranch + tree[index];
if(dia > maxDia)
maxDia = dia;
return Math.max(maxLeftBranch,maxRightBranch);
}
```