This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Three main functions and one utility function for effeciently working with arrays representing weights. | |
buildTree(array) | |
- Takes an array of numbers like [5,0,99,25,2,2] | |
- Returns a tree, which is an array of layers, where the first layer is the input array, | |
the second layer is the sums of every two items in the first layer, and so on. | |
So the output tree with the example input would be: | |
[ |