Home > Blockchain >  Algorithm to minimise the sum of products of leaf values and their depth
Algorithm to minimise the sum of products of leaf values and their depth

Time:01-23

I'm stuck with a computer science problem I'm trying to solve. Suppose you have a binary tree (which does not need to be balanced), where each node has at most two child nodes and where only a leaf can contain an integer value (the root and the middle nodes do not). We are given an array of values and have to construct such a tree with the constraint:

  • Related