# 二叉树：节点数与子树高度之间的除法最大值Binary Tree: maximum value of the division between the number of nodes and the height of a subtree

``````public class BinaryTree {

protected class Node {
protected Integer element;
protected Node left;
protected Node right;

Node(int element) {
this.element = element;
left = right = null;
}

Node(int element, Node left, Node right) {
this.element = element;
this.left = left;
this.right = right;
}

} //end Node class

public class NodeReference {
private Node node;

private NodeReference(Node node) {
this.node = node;
}

public int getElement() {
return node.element;
}

public void setElement(int e) {
node.element = e;
}
}

protected Node root;

public BinaryTree() {
root = null;
}

private class BoolNode {

boolean found;
Node node;

BoolNode(boolean found, Node node) {
this.found = found;
this.node = node;
}
}

public NodeReference ratio() {
if(isEmpty()) //equals to if(root == null)
throw new IllegalStateException("Empty tree.");
else
ratio(root);
}

private NodeReference ratio(Node node) {
//...
}
}
``````

## 1 个回复1

### ===============>>#1 票数：0

...以及子树的高度...

...之间的比例

...返回对节点（或节点之一，...）U的引用，以使比率... 最大化

2回复

1回复

4回复

2回复

3回复

3回复

8回复

1回复

2回复

1回复