edu.stanford.math.plex4.graph.random
public class BinaryTree extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
n |
Constructor and Description |
---|
BinaryTree(int n) |
Modifier and Type | Method and Description |
---|---|
int |
commonAncestorDepth(int i,
int j) |
int |
getCommonAncestor(int i,
int j) |
int |
getDepth(int i)
Returns the depth of a node in a breadth-first labeled binary tree rooted
at 1.
|
int |
getMaxDepth() |
public int getMaxDepth()
public int getDepth(int i)
i
- node labelpublic int getCommonAncestor(int i, int j)
i
- node labelj
- node labelpublic int commonAncestorDepth(int i, int j)
i
- node labelj
- node label