text: Function to construct a tree such that there are no two adjacent nodes with the same weight
code: function construct_tree ( weights , n ) { let minimum = Number . MAX_VALUE ; let maximum = Number . MIN_VALUE ; for ( let i = 0 ; i < weights . length ; i ++ ) { minimum = Math . min ( minimum , weights [ i ] ) ; maximum = Math . max ( maximum , weights [ i ] ) ; }