标签:blog ar os on div log bs ef amp
void Closed(TreeNode * root, const int val, int & res) { if(root==NULL) return INT_MAX; if(root->left) Closed(root->left,val,res); if(abs(root->val - val) < abs(res - val)) { res = root->val; } if(root->val < val && root->right) { Colsed(root->right,val,res); } }
给一个target number,在BST上找到closest point
标签:blog ar os on div log bs ef amp
原文地址:http://www.cnblogs.com/jobfindingnotes/p/4116616.html