6-3 No Greater Than X in BST (15 分)
时间限制: 400 ms 内存限制: 64 MB 代码长度限制: 16 KB
You are supposed to output, in decreasing order, all the elements no greater than X
in a binary search tree T
.
Format of function:
void Print_NGT( Tree T, int X );
where Tree
is defined as the following:
typedef struct TreeNode *Tree;
struct TreeNode {
int Element;
Tree Left;
Tree Right;
};
The function is supposed to use Output(X)
to print X
.
Sample program of judge:
#include <stdio.h>
#include <stdlib.h>
typedef struct TreeNode *Tree;
struct TreeNode {
int Element;
Tree Left;
Tree Right;
};
Tree BuildTree(); /* details omitted */
void Output( int X ); /* details omitted */
void