dsa3 min read
Step-By-Step Directions From a Binary Tree Node to Another
Find path directions between two tree nodes by finding LCA then building paths from LCA to each target.
Read →
webcoderspeed.com
1276 articles
Find path directions between two tree nodes by finding LCA then building paths from LCA to each target.
Verify a binary tree is complete using BFS: once a null child is seen, no more non-null nodes should follow.
Find and swap the two misplaced nodes in a BST using in-order traversal to detect the violations.
Maximize robbery from a tree-structured neighborhood where adjacent (parent-child) nodes cannot both be robbed.
Find minimum cameras to monitor all nodes using greedy bottom-up: prefer placing cameras at parents of uncovered leaves.