如何为 BST 节点创建构造函数?

How do I make a constructor for a BST Node?

我需要再做一个 class 吗?例如人?

抱歉我的编程技术生疏了。

public class Node 
{
    Node left;
    Node right;
    Node parent;
    String name;
    String DoB;
    int phoneNumber;

....

}

public class BST {
    Node root;
    int size;
    
...
}

你可以这样直接实现:

public class BSTNode {

    BSTNode left;
    BSTNode right;
    BSTNode parent;
    String name;
    String DoB;
    int phoneNumber;

....

}

// 初始化

BSTNode() {}

//如果只有一个节点

   BSTNode(String name, String DoB, int phoneNumber) {
   this.name=name;
   this.DoB=Dob;
   this.phoneNumber=phoneNumber;
   }

//如果bst包含多个节点

BSTNode(String name, String DoB, int phoneNumber,BSTNode parent,BSTNode 
left,BSTNode right){
     this.parent=parent;
     this.left=left;
     this.right=right;
     this.name=name;
     this.DoB=Dob;
     this.phoneNumber=phoneNumber;
     }