binary-search-tree

    3热度

    4回答

    我们知道预定序,遍历序和遍历序。什么算法会重建BST?

    0热度

    1回答

    我必须编写一些BST的方法,我有一些问题,让我解释一下。 我具有以下结构: struct node { struct node *lChild; struct node *rChild; int value; }; 和 struct tree { struct node *root; }; 具有以下功能沿着: struct tree* const

    0热度

    2回答

    #include <iostream> using namespace std; #define YES 1 #define NO 0 class tree { private: struct leaf { int data; leaf *l; leaf *r; }; struct

    -1热度

    2回答

    #include <iostream> using namespace std; #define YES 1 #define NO 0 class tree { private: public: struct leaf { int data; leaf *l; leaf *r; };

    1热度

    1回答

    #ifndef _BST_H_ /* Returns negative (left<right), zero (left==right), or positive (left>right). */ typedef int comparator(void* left, void* right); struct bst_node { void* data; struct

    1热度

    1回答

    您好我目前正在做我的项目(算法可视化工具)的测试阶段。我遇到了我的BST删除方法的问题。 public boolean delete(String key) { boolean deleted = true; boolean finished=false; BNode current = root; BNode prev = null; while (!finished) {

    0热度

    2回答

    给定数据集(8,1,6,9,3,5,4,7),我得出了以下二叉搜索树: 8 /\ 1 9 \ 6 /\ 3 7 \ 5 / 4 我的问题是,如果我想从这棵树中删除根节点(8),我该如何去做,结果树结构是什么样子?非常感谢您的帮助!

    0热度

    1回答

    我正在对二叉搜索树进行编码,并且在找到有效删除节点的方法时遇到了一些问题。 我有这样的代码: struct node* deleteNode(int i, struct node *N) { if (N==NULL) { return NULL; } else if (i<N->value) { N->size--;

    1热度

    4回答

    我通过过去的考试试卷工作我先进的编程课程,我已经在这个问题 必须在二叉搜索树中的值满足什么性质得到卡住?有多少个不同的二叉搜索树包含三个值1 2 3?解释你的答案。 我可以很容易地回答第一部分,但第二位,关于可能的树数量我已经难倒了。我的第一本能是说只有一棵树是可能的,以2为根,因为定义是这样说的,但这个问题是整个论文中共有100个作品的总分为100,所以我只能假设这是一个狡猾的问题,还有一个更微

    4热度

    3回答

    我正在尝试制作二叉搜索树中所有项目的列表。我理解递归,但我不知道如何让它返回每个值,然后将其附加到列表中。我想创建一个名为makeList()的函数,它将返回我树中所有项目的列表。除了makeList()函数之外,我的程序中的所有函数都可以工作,并且可以确保每个人都了解我设置树的基本结构。我makeList()功能 class Node(object): def __init__(sel