1 void BST(TreeNode root, int target) 2 { 3 if (root.val == target) 4 // 找到目标,做点什么 5 if (root.val < target) 6 BST(root.right, target); 7 if (root.val > target) 8 BST(root.left, target); 9 }
BST 的遍历框架
原文:https://www.cnblogs.com/yuhong1103/p/12851184.html