Skip to content

Commit 984fa4d

Browse files
committed
Modifying Comments for Problem - 938 - Range Sum BST
1 parent e1f0edd commit 984fa4d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Range_Sum_BST/EfficientSolution.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def _rangeSumBST(self, curr_node, L, R, Sum): #Defining our helper method
2727
return Sum #We return Sum
2828
if L <= curr_node.val <= R: #Condition-check: If our curr_node.val is in the range of [L, R]
2929
Sum += curr_node.val #Sum is Sum + curr_node.val
30-
Sum = self._rangeSumBST(curr_node.left, L, R, Sum) #Calling helper method
31-
Sum = self._rangeSumBST(curr_node.right, L, R, Sum) #Calling helper method
30+
Sum = self._rangeSumBST(curr_node.left, L, R, Sum) #Calling helper method for left sub-tree
31+
Sum = self._rangeSumBST(curr_node.right, L, R, Sum) #Calling helper method for right sub-tree
3232
if curr_node.val < L: #Condition-check: if curr_node.val is less than L
33-
Sum = self._rangeSumBST(curr_node.right, L, R, Sum) #Calling helper method
33+
Sum = self._rangeSumBST(curr_node.right, L, R, Sum) #Calling helper method for right sub-tree of curr_node.val
3434
if curr_node.val > R: #Condition-check: if curr_node.val is greater than R
35-
Sum = self._rangeSumBST(curr_node.left, L, R, Sum) #Calling helper method
35+
Sum = self._rangeSumBST(curr_node.left, L, R, Sum) #Calling helper method for left sub-tree of curr_node.val
3636
return Sum #Return total Sum at the end.

0 commit comments

Comments
 (0)