Recursively call the buildTree on both the nodes of the tree
let mid = Math . floor ( ( s + e ) / 2 ) ; buildTree ( tree , arr , 2 * index , s , mid ) ; buildTree ( tree , arr , 2 * index + 1 , mid + 1 , e ) ;