Transforming a Binary Search Tree into a Greater Sum Tree
Recall the properties of a BST:
The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with keys greater than the node's key.
Both the left and right subtrees must also be binary search trees.
Example Scenarios
Input: [4,1,6,0,2,5,7,null,null,null,3,null,null,null,8]
...
Posted on Mon, 11 May 2026 11:06:25 +0000 by DBHostS
Binary Tree Traversal Techniques and Common Algorithmic Patterns
Binary trees serve as foundational structures for many advanced topics such as dynamic programming and backtracking. Mastery of their traversal methods is essential.
Core Traversal Strategies
Two primary strategies exist: depth-first and breadth-first.
Depth-First Traversal
Explores as far as possible along each branch before backtracking. Vari ...
Posted on Fri, 08 May 2026 01:12:02 +0000 by mattbarber