Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MinimumSumLevel ¶
func MinimumSumLevel(tree *BinaryTree) (minSum int, minLevel int)
MinimumSumLevel returns both the 1-based level and sum of that level. Runs in O(N) time and O(1) extra space. If you pass in "nil", the sum is 0 and the level is 0.
Types ¶
type BinaryTree ¶
type BinaryTree struct { Value int Left, Right *BinaryTree }
BinaryTree is a binary tree of integers.
Click to show internal directories.
Click to hide internal directories.