algorithms
algorithms copied to clipboard
Tree can become linear instead of binary
According to your code, if all the distance are equal(in build function), the tree will become linear and time complexity will increase.