Documentation ¶
Index ¶
Constants ¶
View Source
const MaxInt = int(^uint(0) >> 1)
MaxInt is the largest int.
View Source
const MinInt = -MaxInt - 1
MinInt is the smallest int.
Variables ¶
This section is empty.
Functions ¶
func SizeOfLargestBST ¶
func SizeOfLargestBST(tree *BinaryTree) int
SizeOfLargestBST will return the number of nodes in the largest BST in the binary tree. Runs in O(N) time with no extra space.
Types ¶
type BinaryTree ¶
type BinaryTree struct { Value int Left, Right *BinaryTree }
BinaryTree is a binary tree: left & right children.
func FindLargestBST ¶
func FindLargestBST(tree *BinaryTree) *BinaryTree
FindLargestBST will return a pointer to the root of the largest BST in the binary tree. Runs in O(N) time with no extra space.
Click to show internal directories.
Click to hide internal directories.