Update BST Binary Search Tree.java #20
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the leftmostSum, rightmostSum, and lastNodeSum methods, you're calculating the sums correctly, but the results are not being used or returned properly. You need to return the calculated sums from these methods.
The sameParent method is declared as an instance method, but it's used as if it's a static method in the comment. Depending on how you intend to use it, you should declare it as a static method or adjust its usage accordingly.
In the preOrderBST and bstFromPreorder methods, you should consider changing the parameter type to long[] to match the data type you're working with (i.e., long) in your TreeNode.
There is a missing import statement for BigInteger. You should add the following import statement at the beginning of your code: