The height of binary tree is maximum of all depths . Find the maximum value in depth and assign it to ht .
var ht = depth [ 0 ] ; for ( i = 1 ; i < n ; i ++ ) { if ( ht < depth [ i ] ) { ht = depth [ i ] ; } } return ht ; }