📄 9.32.txt
字号:
void Out_X(BiTree t, KeyType x, KeyType &a, KeyType &b,int &last);
void OutX(BiTree t, KeyType x, KeyType &a, KeyType &b)
/* a: Return the nearest and smaller value to x, */
/* but return MINV if no the value in t. */
/* b: Return the nearest and larger value to x. */
/* but return MAXV if no the value in t. */
{
int last = 0;
a = b = 0;
Out_X(t, x, a, b, last);
if(a == 0) a = MINV;
if(b == 0) b = MAXV;
}
void Out_X(BiTree t, KeyType x, KeyType &a, KeyType &b,int &last)
{
if(t->lchild) Out_X(t->lchild, x, a, b, last);
if(last < x && t->data.key >= x) a = last;
if(last <= x&& t->data.key > x) b = t->data.key;
last = t->data.key;
if(t->rchild) Out_X(t->rchild, x, a, b, last);
else if( last < x) a = last;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -