running_sum
to 0 to keep track of the sum of node values visited so far.reverse_inorder
that takes a node and the running sum as arguments.reverse_inorder
on the right child.running_sum
.running_sum
.reverse_inorder
on the left child.reverse_inorder
on the root node to start the process.