Driver code
let arr = [ 7 , 3 , 9 , 13 , 5 , 4 ] ; let n = arr . length ; let tree = new Array ( ) ; for ( let i = 0 ; i < 4 * n + 1 ; i ++ ) { tree . push ( [ ] ) } buildTree ( tree , arr , 1 , 0 , n - 1 ) ;