首页 > 其他 > 详细

BST 的遍历框架

时间:2020-05-08 16:42:00      阅读:67      评论:0      收藏:0      [点我收藏+]
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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!