小编YuN*_*uNo的帖子

C#实现中的二叉搜索树

class Node
{
    public int data;
    public Node left, right;

    public Node(int data)
    {
        this.data = data;
        left = null;
        right = null;

    }
}

class BinaryTreeImp
{
    Node root;
    static int count = 0;

    public BinaryTreeImp()
    {
        root = null;

    }
    public Node addNode(int data)
    { 
        Node newNode = new Node(data);

        if (root == null)
        {
            root = newNode;

        }
        count++;
        return newNode;


    }

    public void insertNode(Node root,Node newNode )
    {
        Node temp;
        temp = root;

        if (newNode.data < …
Run Code Online (Sandbox Code Playgroud)

c# binary-tree

6
推荐指数
2
解决办法
4万
查看次数

标签 统计

binary-tree ×1

c# ×1