我在我的代码中收到“无法解析符号“左/右””,我不完全理解为什么。我查看了其他示例和帖子,但只是不完全理解我需要做什么来解决我的错误。我将发布与该问题相关的代码部分。对此的任何帮助将不胜感激。谢谢你。**(如果外观有点偏离,我深表歉意。当我剪切并粘贴时,间距似乎有点偏离)
public class SBST <Value>
{
private class Node
{
private Node left;
private Node right;
private String key;
private Value value;
public Node(Node left,Node right, String key, Value value)
{
this.left = left;
this.right = right;
this.key = key;
this.value = value;
}
}
private Node root;
private int size;
private String [] keys;
private Value [] values;
private int currentSize;
private Random rand = new Random();
public SBST (int size)
{
if (size < 0)
{
throw new IllegalArgumentException();
}
else
{
this.size = size;
this.keys = new String[size];
this.values = new Value[size];
this.currentSize = 0;
}
}
public int height(String keys)
{
if (keys == null)
{
return 0;
}
else
{
int l = height(keys.left);
int r = height(keys.right);
if (l > r )
{
return l +1;
}
else
{
return r + 1;
}
}
}