public override void Visit(TreeLeaf leaf) { if (leaf == null) { return; } currentHeight++; maxHeight = Math.Max(maxHeight, currentHeight); currentHeight--; }
public override void Visit(TreeLeaf leaf) { if (heights.Count == 0) { currentHeight = 1; } else { currentHeight = heights[heights.Count - 1]; heights.RemoveAt(heights.Count - 1); } maxHeight = Math.Max(maxHeight, currentHeight); }
public abstract void Visit(TreeLeaf leaf);