binary-tree

    -2热度

    2回答

    public static Node insert(Node root, int data) if (root == null) return new Node(data);

    1热度

    1回答

    今天我收到了一个作业,约function pointer(binary tree)。 有代码,我无法理解一大块......我明白了一个function pointer是什么以及它是如何工作的,但怎么样2 function pointers(1处于parameter) header.h typedef struct _node_ { int key; struct _node_ *left;

    -1热度

    2回答

    没有人知道如何将值保存到左侧或右侧的二叉树中? 比如我们有2层结构: struct A { int a; struct A *left; struct A *right; } struct B { A *root; } ,我们有一个功能: void insert(B *tree, int value) { if(tree== NU

    -1热度

    1回答

    PHYTON - 如何在此代码中创建一个功能来打印每个节点的层次? referrer=input() location=input() readFAQ=input() pagesVisited=input() serviceChosen=input() testCase=[referrer, location, readFAQ, pagesVisited, serviceChosen

    -1热度

    1回答

    System.NullReferenceException:对象不设置到对象的实例 public int find(int value) { Node curr = root; while (curr != null) { if (curr.value == value) { return value;//success }

    1热度

    2回答

    我真的被困在试图弄清楚这一点。 这是树: 5 /\ 4 8 //\ 11 13 4 / \ \ 7 2 1 问: 创建一个函数来搜索上面给出的二叉树的值。如果找到该值,该函数应返回指向该节点的指针;否则函数应该返回一个空指针。这些参数应该是一个指向二叉树根节点的指针和一个要搜索的值。 BinaryTree *sear

    2热度

    2回答

    我有一个问题,解析树代码。当我试图用后期订单展示它时,它给了我一个错误消息,应该是str参数,而不是int。 from classStack import Stack from classTree import BinaryTree def buildParseTree(fpexp): fplist = fpexp.split() pStack = Stack()

    -4热度

    1回答

    例如全部打印出来: 1 / \ / \ 2 3 /\ /\ 4 5 6 7 序遍历输出:4 2 5 1 6 3 7 预期输出:4 -2为序5 -1 6 -3 7 代码是 Node * func(struct Node * root){ if(root!=NULL) { func(root->lChild); cout<<root->no

    2热度

    4回答

    我试图实现一个二叉搜索树,我需要一个函数告诉我一个元素是否已经存在于树中! 但是我唯一可以使用的运营商是<。 这甚至可能吗? 我已经尝试过 和(a<b) || (b<a)!(a<b) && !(b<a) 注:我只允许使用<比较我的元素二叉树。

    1热度

    2回答

    如何发送(node.data)SortTree类到TreePrinter然后用于打印树。 import javax.swing.tree.TreeNode; public class SortTree { static Node root; TreePrinter type =new TreePrinter(); class Node<A extends Comparable>{