Finding the maximum among left and right child
seg_tree [ i ] = max ( buildMaxTree ( l , Math . floor ( ( l + r ) / 2 ) , 2 * i + 1 , arr ) , buildMaxTree ( Math . floor ( ( l + r ) / 2 ) + 1 , r , 2 * i + 2 , arr ) ) ;