6-88 Print the right subtree of X in BST

Given a binary search tree T, you are supposed to output all the elements in the right subtree of X, in decreasing order.

Format of functions:

void print_right_subtree( Tree T, int X );

where Tree is defined as:

typedef struct TreeNode *Tree;
struct TreeNode {
    int element;
    Tree left;
    Tree right;
};

Sample program of judge:

#include <stdio.h>
#include <stdlib.h>

typedef struct TreeNode *Tree;
struct TreeNode {
    int element;
    Tree left;
    Tree right;
};

Tree build_tree(); /* details omitted */

void print_right_subtree(Tree T, int X);

int main()
{
    Tree T;
    int X;

    T = build_tree();
    scanf("%d", &X);
    print_right_subtree(T, X);

    return 0;
}

/* Your function(s) will be put here */

相关推荐

  1. 6-88 Print the right subtree of X in BST

    2024-04-02 08:42:04       14 阅读
  2. MySQL商城数据表(80-88

    2024-04-02 08:42:04       12 阅读
  3. 商城数据库88张表练习85~88

    2024-04-02 08:42:04       14 阅读
  4. 面试经典150题(88-89)

    2024-04-02 08:42:04       33 阅读
  5. MIT 6.858 计算机系统安全讲义 2014 秋季(四)

    2024-04-02 08:42:04       22 阅读
  6. MIT 6.858 计算机系统安全讲义 2014 秋季(一)

    2024-04-02 08:42:04       25 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-02 08:42:04       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-02 08:42:04       18 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-02 08:42:04       17 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-02 08:42:04       20 阅读

热门阅读

  1. 如何重置woocommerce,如何批量删除woocommerce产品

    2024-04-02 08:42:04       12 阅读
  2. StarRocks部署

    2024-04-02 08:42:04       11 阅读
  3. WPF —— 动画

    2024-04-02 08:42:04       12 阅读
  4. react 父子组件的渲染机制 | 优化手段

    2024-04-02 08:42:04       14 阅读
  5. leetcode76最后一个测试用例无法通过

    2024-04-02 08:42:04       13 阅读
  6. SeLinux安全上下文文件

    2024-04-02 08:42:04       13 阅读
  7. C语言函数如何将数组元素作为实参?

    2024-04-02 08:42:04       15 阅读